GoodMemGoodMem

Access Policy

Direct grants and scoped role assignments.

Methods on this page are called through client.access_policy.

client.access_policy.check

client.access_policy.check(request: CheckAuthorizationsRequest, requestOptions?: RequestOptions): Promise<CheckAuthorizationsResponseShape>

Evaluates 1 to 50 concrete operation-and-target checks under the authenticated caller's live authority and any API-key ceiling. Results are positional and advisory: missing targets and denied operations both return allowed=false, and every later resource request performs fresh authorization. Top-level creates target INSTANCE; CREATE_MEMORY and LIST_MEMORY target their parent SPACE; reads, mutations, proxy operations, and access-policy administration target concrete resources. LIST_API_KEY and LIST_RETRIEVE_MEMORY_LOG_POLICY are rejected because their current candidate-based list rules have no instance-wide preflight.

HTTP: POST /v1/access-policy:check

Parameters

ParameterTypeDescription
requestCheckAuthorizationsRequestRequest body.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;CheckAuthorizationsResponseShape&gt;

Example

const authorizationDecisions = await client.accessPolicy.check({
  checks: [
    {
      operation: "READ_INSTANCE",
      target: { kind: "INSTANCE" },
    },
  ],
});
console.log(authorizationDecisions.results[0]?.allowed);

client.access_policy.grantsCreate

client.access_policy.grantsCreate(request: CreateAuthorizationGrantRequest, requestOptions?: RequestOptions): Promise<AuthorizationGrantResponseShape>

Creates one direct grant after resolving its typed policy target and requiring MANAGE_ACCESS. Direct grants cannot confer credential-read or ownership-transfer authority. ALL_AUTHENTICATED grants require an assigned-resource selector. MANAGE_ACCESS and MANAGE_USER_ENROLLMENT require a concrete principal and ANY or EXACT; MANAGE_USER_ENROLLMENT with EXACT must target USER.

HTTP: POST /v1/access-policy/grants

Parameters

ParameterTypeDescription
requestCreateAuthorizationGrantRequestRequest body.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;AuthorizationGrantResponseShape&gt;

Example

const grant = await client.accessPolicy.grantsCreate({
  audience: { principalId },
  rule: {
    operation: "READ_SPACE",
    selector: "EXACT",
    assignedResource: { kind: "SPACE", resourceId: policySpaceId },
  },
});

client.access_policy.grantsDelete

client.access_policy.grantsDelete(id: string, requestOptions?: RequestOptions): Promise<AuthorizationGrantResponseShape>

Soft-revokes one grant and returns its durable historical row. Repeating the request is idempotent while the caller retains MANAGE_ACCESS on the target.

HTTP: DELETE /v1/access-policy/grants/&#123;id&#125;

Parameters

ParameterTypeDescription
idstringGrant UUID
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;AuthorizationGrantResponseShape&gt;

Example

const revokedGrant = await client.accessPolicy.grantsDelete(grant.grantId);

client.access_policy.grantsGet

client.access_policy.grantsGet(id: string, options?: AccessPolicyGrantsGetOptions, requestOptions?: RequestOptions): Promise<AuthorizationGrantResponseShape>

Reads one live grant, or one revoked historical grant when includeRevoked is true, after requiring MANAGE_ACCESS on its policy target.

HTTP: GET /v1/access-policy/grants/&#123;id&#125;

Parameters

ParameterTypeDescription
idstringGrant UUID
optionsAccessPolicyGrantsGetOptions optionalOptional query parameters.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;AuthorizationGrantResponseShape&gt;

Example

const fetchedGrant = await client.accessPolicy.grantsGet(grant.grantId);

client.access_policy.grantsList

client.access_policy.grantsList(options?: AccessPolicyGrantsListOptions, requestOptions?: RequestOptions): Promise<Page<AuthorizationGrantResponseShape>>

Lists grants attached to one resource. MANAGE_ACCESS is required on that resource; continuation tokens are bound to the caller and filters.

HTTP: GET /v1/access-policy/grants

Parameters

ParameterTypeDescription
optionsAccessPolicyGrantsListOptions optionalOptional query parameters.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;Page&lt;AuthorizationGrantResponseShape&gt;&gt;

Example

for await (const visibleGrant of await client.accessPolicy.grantsList({
  resourceKind: "SPACE",
  resourceId: policySpaceId,
})) {
  console.log(visibleGrant.grantId);
}

client.access_policy.roleAssignmentsCreate

client.access_policy.roleAssignmentsCreate(request: AssignRoleRequest, requestOptions?: RequestOptions): Promise<RoleAssignmentResponseShape>

Assigns one code-defined role to an active principal at INSTANCE or SPACE scope after requiring MANAGE_ACCESS. ROOT is maintained only by ownership workflows.

HTTP: POST /v1/access-policy/role-assignments

Parameters

ParameterTypeDescription
requestAssignRoleRequestRequest body.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;RoleAssignmentResponseShape&gt;

Example

const assignment = await client.accessPolicy.roleAssignmentsCreate({
  principalId,
  role: "SPACE_VIEWER",
  assignedResource: { kind: "SPACE", resourceId: policySpaceId },
});

client.access_policy.roleAssignmentsDelete

client.access_policy.roleAssignmentsDelete(id: string, requestOptions?: RequestOptions): Promise<RoleAssignmentResponseShape>

Soft-revokes one non-ROOT assignment and returns its durable historical row. Repeating the request is idempotent while the caller retains MANAGE_ACCESS.

HTTP: DELETE /v1/access-policy/role-assignments/&#123;id&#125;

Parameters

ParameterTypeDescription
idstringRole-assignment UUID
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;RoleAssignmentResponseShape&gt;

Example

const revokedAssignment = await client.accessPolicy.roleAssignmentsDelete(
  assignment.roleAssignmentId,
);

client.access_policy.roleAssignmentsGet

client.access_policy.roleAssignmentsGet(id: string, options?: AccessPolicyRoleAssignmentsGetOptions, requestOptions?: RequestOptions): Promise<RoleAssignmentResponseShape>

Reads one live assignment, or one revoked historical assignment when includeRevoked is true, after requiring MANAGE_ACCESS on its policy target.

HTTP: GET /v1/access-policy/role-assignments/&#123;id&#125;

Parameters

ParameterTypeDescription
idstringRole-assignment UUID
optionsAccessPolicyRoleAssignmentsGetOptions optionalOptional query parameters.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;RoleAssignmentResponseShape&gt;

Example

const fetchedAssignment = await client.accessPolicy.roleAssignmentsGet(
  assignment.roleAssignmentId,
);

client.access_policy.roleAssignmentsList

client.access_policy.roleAssignmentsList(options?: AccessPolicyRoleAssignmentsListOptions, requestOptions?: RequestOptions): Promise<Page<RoleAssignmentResponseShape>>

Lists assignments attached to one required INSTANCE or SPACE boundary after requiring MANAGE_ACCESS. Continuation tokens are bound to the caller and filters.

HTTP: GET /v1/access-policy/role-assignments

Parameters

ParameterTypeDescription
optionsAccessPolicyRoleAssignmentsListOptions optionalOptional query parameters.
requestOptionsRequestOptions optionalPer-call signal, timeout, or headers.

Returns: Promise&lt;Page&lt;RoleAssignmentResponseShape&gt;&gt;

Example

for await (const visibleAssignment of await client.accessPolicy.roleAssignmentsList({
  resourceKind: "SPACE",
  resourceId: policySpaceId,
})) {
  console.log(visibleAssignment.roleAssignmentId);
}

Data Models

Enum Values

GrantAudienceAllAuthenticated

True

Role

ROOT, ADMIN, USER, SPACE_VIEWER, SPACE_CONTRIBUTOR, SPACE_CONTENT_MANAGER, SPACE_ADMIN

Interfaces

AssignRoleRequest

Assigns one code-defined role at an INSTANCE or SPACE boundary.

FieldTypeRequiredDescription
roleAssignmentIdstring | nullnoOptional caller-provided role-assignment UUID.
principalIdstringyesActive principal receiving the role.
role"ADMIN" | "USER" | "SPACE_VIEWER" | "SPACE_CONTRIBUTOR" | "SPACE_CONTENT_MANAGER" | "SPACE_ADMIN"yesCode-defined non-ROOT role to assign.
assignedResourceRoleAssignmentTargetyesINSTANCE or SPACE boundary receiving the assignment.

AuthorizationCheck

One concrete, advisory authorization check. Top-level creates target INSTANCE; CREATE_MEMORY and LIST_MEMORY target a parent SPACE; ordinary resource operations target the concrete resource. LIST_API_KEY and LIST_RETRIEVE_MEMORY_LOG_POLICY are not supported by this endpoint.

FieldTypeRequiredDescription
operationOperationyesOperation the caller proposes to perform.
targetAccessPolicyTargetyesTarget required by the operation: INSTANCE for top-level creates, parent SPACE for CREATE_MEMORY or LIST_MEMORY, otherwise the concrete resource.

AuthorizationCheckResult

One advisory decision; false covers both an absent target and an authorization denial.

FieldTypeRequiredDescription
allowedbooleanyesWhether the caller currently has effective authority.

AuthorizationGrant

Current or historical direct authorization grant.

FieldTypeRequiredDescription
grantIdstringyesDurable grant UUID.
audienceGrantAudienceyesGrant audience.
ruleAccessPolicyRuleyesGranted authorization descriptor.
createdAtnumberyesCreation time in epoch milliseconds.
createdByIdstringyesExact audit actor that created the grant.
revokedAtnumber | nullnoRevocation time in epoch milliseconds, when revoked.
revokedByIdstring | nullnoExact audit actor that revoked the grant, when revoked.

CheckAuthorizationsRequest

Evaluates between 1 and 50 concrete authorization checks.

FieldTypeRequiredDescription
checksArray&lt;AuthorizationCheck&gt;yesConcrete checks evaluated in request order.

CheckAuthorizationsResponse

Positional advisory authorization results.

FieldTypeRequiredDescription
resultsArray&lt;AuthorizationCheckResult&gt;yesResults corresponding one-for-one with the request checks.

CreateAuthorizationGrantRequest

Creates one live direct authorization grant.

FieldTypeRequiredDescription
grantIdstring | nullnoOptional caller-provided grant UUID.
audienceGrantAudienceyesAudience receiving the grant.
ruleAccessPolicyRuleyesAuthorization descriptor to grant.

GrantAudience

Exactly one principal or the all-authenticated audience.

FieldTypeRequiredDescription
principalIdstring | nullnoActive HUMAN or SERVICE principal UUID.
allAuthenticatedGrantAudienceAllAuthenticated | nullnoSet to true to address every authenticated principal.

ListAuthorizationGrantsResponse

One page of direct authorization grants.

FieldTypeRequiredDescription
grantsArray&lt;AuthorizationGrant&gt;yesGrant rows in stable creation order.
nextTokenstring | nullnoOpaque continuation token, omitted on the final page.

ListRoleAssignmentsResponse

One page of scoped role assignments.

FieldTypeRequiredDescription
roleAssignmentsArray&lt;RoleAssignment&gt;yesRole assignments in stable assignment order.
nextTokenstring | nullnoOpaque continuation token, omitted on the final page.

RoleAssignment

Current or historical scoped role assignment.

FieldTypeRequiredDescription
roleAssignmentIdstringyesDurable role-assignment UUID.
principalIdstringyesAssigned principal UUID.
roleRoleyesCode-defined assigned role.
assignedResourceRoleAssignmentTargetyesINSTANCE or SPACE assignment boundary.
assignedAtnumberyesAssignment time in epoch milliseconds.
assignedByIdstringyesExact audit actor that assigned the role.
revokedAtnumber | nullnoRevocation time in epoch milliseconds, when revoked.
revokedByIdstring | nullnoExact audit actor that revoked the assignment, when revoked.

RoleAssignmentTarget

An INSTANCE or SPACE role-assignment boundary. resourceId is omitted for INSTANCE and required for SPACE.

FieldTypeRequiredDescription
kind"INSTANCE" | "SPACE"yesRole-assignment target kind.
resourceIdstring | nullnoMemory-space UUID; omitted for the singleton INSTANCE target.

Response Shapes

Response shape types model values returned by the SDK after forward-compatible unknown enum strings are coerced to null.

AuthorizationCheckResultResponseShape

FieldTypeRequiredDescription
allowedbooleanyesWhether the caller currently has effective authority.

AuthorizationGrantResponseShape

FieldTypeRequiredDescription
grantIdstringyesDurable grant UUID.
audienceGrantAudienceResponseShapeyesGrant audience.
ruleAccessPolicyRuleResponseShapeyesGranted authorization descriptor.
createdAtnumberyesCreation time in epoch milliseconds.
createdByIdstringyesExact audit actor that created the grant.
revokedAtnumber | nullnoRevocation time in epoch milliseconds, when revoked.
revokedByIdstring | nullnoExact audit actor that revoked the grant, when revoked.

CheckAuthorizationsResponseShape

FieldTypeRequiredDescription
resultsArray&lt;AuthorizationCheckResultResponseShape&gt;yesResults corresponding one-for-one with the request checks.

GrantAudienceResponseShape

Type constraint: GrantAudienceResponseShape = RequireExactlyOne&lt;GrantAudienceResponseShapeBase, "allAuthenticated" \| "principalId"&gt;

FieldTypeRequiredDescription
principalIdstring | nullnoActive HUMAN or SERVICE principal UUID.
allAuthenticatedGrantAudienceAllAuthenticated | nullnoSet to true to address every authenticated principal.

ListAuthorizationGrantsResponseShape

FieldTypeRequiredDescription
grantsArray&lt;AuthorizationGrantResponseShape&gt;yesGrant rows in stable creation order.
nextTokenstring | nullnoOpaque continuation token, omitted on the final page.

ListRoleAssignmentsResponseShape

FieldTypeRequiredDescription
roleAssignmentsArray&lt;RoleAssignmentResponseShape&gt;yesRole assignments in stable assignment order.
nextTokenstring | nullnoOpaque continuation token, omitted on the final page.

RoleAssignmentResponseShape

FieldTypeRequiredDescription
roleAssignmentIdstringyesDurable role-assignment UUID.
principalIdstringyesAssigned principal UUID.
roleRole | nullyesCode-defined assigned role.
assignedResourceRoleAssignmentTargetResponseShapeyesINSTANCE or SPACE assignment boundary.
assignedAtnumberyesAssignment time in epoch milliseconds.
assignedByIdstringyesExact audit actor that assigned the role.
revokedAtnumber | nullnoRevocation time in epoch milliseconds, when revoked.
revokedByIdstring | nullnoExact audit actor that revoked the assignment, when revoked.

RoleAssignmentTargetResponseShape

FieldTypeRequiredDescription
kind"INSTANCE" | "SPACE" | nullyesRole-assignment target kind.
resourceIdstring | nullnoMemory-space UUID; omitted for the singleton INSTANCE target.