Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

Access checks

One decision for “may this principal do this to that resource?”, with a reason an app or an agent can act on. Every answer names its config version.

Access checks explains the order a check takes and what each reason means.

Paths are relative to https://api.agentpost.tools/v1/identity, and every request follows the API basics. Who may call explains each kind of caller.

Check access

POST /access/check

Allowed or denied, with the reason. explain: true adds each step; audit: true records a denial in the change feed.

  • Who may call: Your server or a signed-in principal.
  • Access: A principal checks itself, and a principal with a delegated token checks within its delegation. A trusted caller names any principalId, and may name a delegateId and delegationId.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • SDK: client.access.check(request)
  • Idempotency-Key: not taken. A check reads the current permissions, so IdentityHound runs it on every request and it takes no Idempotency-Key. With audit: true, a retried denial is recorded again.

Body

Name Type Required Description
principalId string No A principal ID, prn_….
delegateId string No The delegate that would act for principalId under a delegation. The check then holds the delegate to that delegation.
delegationId string No The delegation the delegate acts under, dlg_…. Left out, the check uses the newest active delegation from the principal to the delegateId that covers the permission, among those for the resource’s workspace or for none.
action string Yes An action of the resource type, such as “edit” or “transaction.view”.
resource object Yes
resource.type string Yes
resource.id string Yes
resource.workspaceId string No The workspace the resource belongs to. Workspace roles count only when it is set, so leave it out only for a resource outside any workspace.
explain boolean No
audit boolean No

Response

200 OK, with CheckResponse.

Errors

Any operation can also answer with the codes Conventions lists.

Check access in a batch

POST /access/check-batch

Up to 100 checks in one call, answered in order.

  • Who may call: Your server or a signed-in principal.
  • Access: Each check follows the rules of POST /access/check.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • SDK: client.access.checkBatch(checks)
  • Idempotency-Key: not taken. A check reads the current permissions, so IdentityHound runs it on every request and it takes no Idempotency-Key. With audit: true, a retried denial is recorded again.

Body

Name Type Required Description
checks object[] Yes 1–100 items.
checks[].principalId string No A principal ID, prn_….
checks[].delegateId string No The delegate that would act for principalId under a delegation. The check then holds the delegate to that delegation.
checks[].delegationId string No The delegation the delegate acts under, dlg_…. Left out, the check uses the newest active delegation from the principal to the delegateId that covers the permission, among those for the resource’s workspace or for none.
checks[].action string Yes An action of the resource type, such as “edit” or “transaction.view”.
checks[].resource object Yes
checks[].resource.type string Yes
checks[].resource.id string Yes
checks[].resource.workspaceId string No The workspace the resource belongs to. Workspace roles count only when it is set, so leave it out only for a resource outside any workspace.
checks[].explain boolean No
checks[].audit boolean No

Response

200 OK, with CheckBatchResponse.

Errors

Any operation can also answer with the codes Conventions lists.

List permissions on a resource

GET /access/permissions

Every permission a principal holds on one resource. An agent calls this to find what it may do. An action that would be denied for any reason, including a missing entitlement, is left out; POST /access/check says why.

  • Who may call: Your server or a signed-in principal.
  • Access: A principal asks about itself; a trusted caller names any principalId.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • SDK: client.access.permissions(query)

Query parameters

Name Type Required Description
principalId string No A principal ID, prn_….
resourceType string Yes
resourceId string Yes
workspaceId string No The workspace the resource belongs to. Workspace roles count only when it is set.

Response

200 OK, with PermissionsResponse.

Errors

Any operation can also answer with the codes Conventions lists.

The CheckResponse object

Name Type Present Description
allowed boolean Always
reason string Always One of "project_role", "workspace_role", "resource_role", "unknown_permission", "principal_inactive", "actor_inactive", "delegation_missing", "delegation_expired", "delegation_scope", "delegation_workspace", "credential_restricted", "no_access", "workspace_archived", or "entitlement_missing".
matched object When set
matched.role string When set
matched.membershipId string When set A membership ID, mem_….
matched.resourceRoleId string When set A resource role ID, rro_….
matched.grantId string When set A grant ID, grt_….
matched.delegationId string When set A delegation ID, dlg_….
configVersion number Always
steps object[] When set
steps[].step string Always
steps[].outcome string Always One of "pass", "fail", or "skip".
steps[].detail string When set

The CheckBatchResponse object

Name Type Present Description
results CheckResponse array Always

The PermissionsResponse object

Name Type Present Description
permissions string[] Always
configVersion number Always