Skip to main content

How to list a customer's assets

Read back the assets belonging to one customer's organization, using the list-org-assets query workflow.

Prerequisites​

  • An enrollment group whose workflows set includes list-org-assets
  • The customer's external id
  • A JWT access token with onboarding management permissions
export API="https://api.example.com/api"
export TOKEN="YOUR_ACCESS_TOKEN"
export GROUP_ID="YOUR_ENROLLMENT_GROUP_ID"

Steps​

Run the workflow with the customer's external id. The group supplies the parent organization.id:

curl -X POST "$API/enrollment-groups/$GROUP_ID/workflows/list-org-assets/run" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "params": { "customer.id": "customer-ext-42" } }'

The workflow is read-only, but it is still invoked with POST — it takes inputs in a request body and its result is not cacheable.

Verify it worked​

{
"outputs": {
"org.id": "9f6f6c2e-4d1a-4c8b-9f3e-2a7b1c5d8e04",
"asset.ids": ["asset-a", "asset-b"]
}
}

There is no runId and no subject. Read-only workflows take no lock and write no run record, so this call will not appear in GET /api/workflow-runs.

Caveats​

Results are eventually consistent. Asset relations are read at whatever revision the permission store happens to serve. A device activated moments earlier may not appear yet.

Do not use this as a read-your-writes confirmation for an activation you just performed — there is no such guarantee. To confirm an activation, read the run record or the device instead:

curl -s "$API/workflow-runs?subjectId=temp-sensor-001&limit=1" \
-H "Authorization: Bearer $TOKEN" | jq '.items[0].outcome'

Concurrent queries never conflict. No lock is taken, so you can run this as often as you like without contending with activations in flight.

If it doesn't work​

404 organization_not_found — no organization with that external id exists under the parent, or your caller identity cannot view it. The failure is step-attributed and carries no runId.

401 caller_identity_missing — the request reached the workflow without a resolvable caller identity. Check the token.

404 workflow_not_found — list-org-assets is not in this group's workflows set. Add it with a PATCH on the group. workflows is replaced as a whole, so send the existing slugs as well as list-org-assets.

See also​