GoodMemGoodMem
ReferenceAPIREST APIAccess Policy

Create an authorization grant

POST /v1/access-policy/grants: Creates one direct grant after resolving its typed policy target and requiring MANAGE_ACCESS.

POST
/v1/access-policy/grants

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.

Authorization

ApiKeyAuth
headerx-api-key<token>

Header Parameters

GoodMem-Timeout-Ms?integer

Optional waiting budget in milliseconds, measured from REST servlet ingress and shared across all internal gRPC calls. Supply one decimal integer from 1 to 86400000. Omission adds no deadline. Existing shorter deadlines still apply. Expiry returns HTTP 504 before streaming starts; after streaming starts, no successful completion event is sent. Use SSE or opt into GoodMem-Stream-Terminal for an explicit terminal outcome. Retrieval work is cooperatively cancelled. An accepted mutation may still commit after timeout or disconnect; a failed response does not imply rollback.

Formatint64
Range1 <= value <= 86400000

Request Body

application/json
  1. body

Creates one live direct authorization grant.

grantId?|

Optional caller-provided grant UUID.

Formatuuid
Example"f276b9a4-73d6-4e04-95c5-87b974221f92"
audience*|

Audience receiving the grant.

rule*

Authorization descriptor to grant.

Response Body

Grant created

application/json
  1. response

Current or historical direct authorization grant.

grantId*string

Durable grant UUID.

Formatuuid
Example"f276b9a4-73d6-4e04-95c5-87b974221f92"
audience*|

Grant audience.

rule*

Granted authorization descriptor.

createdAt*integer

Creation time in epoch milliseconds.

Formatint64
createdById*string

Exact audit actor that created the grant.

Formatuuid
Example"70e025f6-76ca-4cbe-b8fc-7dab8e84590a"
revokedAt?|

Revocation time in epoch milliseconds, when revoked.

Formatint64
revokedById?|

Exact audit actor that revoked the grant, when revoked.

Formatuuid
Example"114ad558-323d-4b76-85b8-37af103b8650"
Example Request
curl -X POST 'https://your-goodmem-server.example.com/v1/access-policy/grants' \  -H 'GoodMem-Timeout-Ms: 30000' \  -H 'Content-Type: application/json' \  -d '{  "grantId": "f276b9a4-73d6-4e04-95c5-87b974221f92",  "audience": {    "principalId": "70e025f6-76ca-4cbe-b8fc-7dab8e84590a"  },  "rule": {    "assignedResource": {      "resourceId": "550e8400-e29b-41d4-a716-446655440000"    }  }}'
Example Response
{  "grantId": "f276b9a4-73d6-4e04-95c5-87b974221f92",  "audience": {    "principalId": "70e025f6-76ca-4cbe-b8fc-7dab8e84590a"  },  "rule": {    "operation": "CREATE_USER",    "selector": "ANY",    "assignedResource": {      "resourceId": "550e8400-e29b-41d4-a716-446655440000"    }  },  "createdAt": 0,  "createdById": "70e025f6-76ca-4cbe-b8fc-7dab8e84590a",  "revokedAt": 0,  "revokedById": "114ad558-323d-4b76-85b8-37af103b8650"}