Skip to main content
POST /v1/tenants/{tenant_id}/bundle/write The Write Bundle endpoint stores named bundle definitions for a tenant. Each bundle describes a set of relationship and attribute write/delete operations parameterized with template variables. Bundles are executed via the Run Bundle endpoint (POST /v1/tenants/{tenant_id}/data/run-bundle), letting you atomically apply a predictable set of authorization data changes in response to application events (e.g. organization_created, user_invited).

Path Parameters

tenant_id
string
required
The tenant identifier. Use t1 for single-tenant deployments. Must match ^([a-zA-Z0-9_\-@\.:+]{1,128}|\*)$.

Request Body

bundles
array
required
One or more bundle definitions to write.

Response

names
array
The names of the bundles that were successfully written.

Example

curl --location --request POST 'localhost:3476/v1/tenants/{tenant_id}/bundle/write' \
--header 'Content-Type: application/json' \
--data-raw '{
    "bundles": [
        {
            "name": "organization_created",
            "arguments": [
                "creatorID",
                "organizationID"
            ],
            "operations": [
                {
                    "relationships_write": [
                        "organization:{{.organizationID}}#admin@user:{{.creatorID}}",
                        "organization:{{.organizationID}}#manager@user:{{.creatorID}}"
                    ],
                    "attributes_write": [
                        "organization:{{.organizationID}}$public|boolean:false"
                    ]
                }
            ]
        }
    ]
}'
Request body
{
  "bundles": [
    {
      "name": "organization_created",
      "arguments": ["creatorID", "organizationID"],
      "operations": [
        {
          "relationships_write": [
            "organization:{{.organizationID}}#admin@user:{{.creatorID}}",
            "organization:{{.organizationID}}#manager@user:{{.creatorID}}"
          ],
          "attributes_write": [
            "organization:{{.organizationID}}$public|boolean:false"
          ]
        }
      ]
    }
  ]
}
Response
{
  "names": ["organization_created"]
}

Error Codes

HTTP StatusDescription
400Bad request — invalid bundle definition
401Unauthorized
404Tenant not found
429Rate limit exceeded
500Internal server error

Build docs developers (and LLMs) love