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
The tenant identifier. Use t1 for single-tenant deployments. Must match ^([a-zA-Z0-9_\-@\.:+]{1,128}|\*)$.
Request Body
One or more bundle definitions to write. A unique name for the bundle (e.g. organization_created). Used to reference the bundle when running it.
List of argument names (strings) that callers must supply when running the bundle (e.g. ["creatorID", "organizationID"]).
List of operations that define what data to write or delete. Each operation is applied atomically. Show operation properties
Relationship tuples to create, using Go template syntax for substitution (e.g. "organization:{{.organizationID}}#admin@user:{{.creatorID}}").
Relationship tuples to delete, using template syntax.
Attributes to write, using template syntax (e.g. "organization:{{.organizationID}}$public|boolean:false").
Attributes to delete, using template syntax.
Response
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 Status Description 400Bad request — invalid bundle definition 401Unauthorized 404Tenant not found 429Rate limit exceeded 500Internal server error