Update organization metadata
const url = 'https://api.toriiauth.eu/api/server/v1/organizations/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/metadata';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"publicMetadata":{"plan":"enterprise"},"privateMetadata":{"crmAccountId":"acct_123"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.toriiauth.eu/api/server/v1/organizations/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/metadata \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "publicMetadata": { "plan": "enterprise" }, "privateMetadata": { "crmAccountId": "acct_123" } }'Deep-merges into either metadata bag. Each bag is tri-state: omit the key to leave the bag unchanged, or send an object to deep-merge into it (a key set to null removes it). Each bag is capped at 8 KB on its own, measured on the merged result rather than on the patch you send. A request naming neither bag is a 400.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Public metadata bag. An organization’s bag is readable over the client API by any member; a MEMBERSHIP’s bags are server-plane only and are never returned on a client-facing read. Capped at 8 KB on its own.
object
Example
{ "plan": "enterprise"}Private metadata bag: server-only. Never exposed to the SDK, never in a JWT. Capped at 8 KB on its own.
object
Example
{ "crmAccountId": "acct_123"}Responses
Section titled “Responses”The updated organization.
object
object
object
Examplegenerated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "slug": "example", "roleSetId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "publicMetadata": {}, "privateMetadata": {}, "createdAt": "2026-04-15T12:00:00Z"}The merged metadata exceeds the size limit.
object
object
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "https://example.com", "properties": { "additionalProperty": "example" }}Missing or invalid secret key.
object
object
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "https://example.com", "properties": { "additionalProperty": "example" }}No organization with this id in the key’s environment.
object
object
Examplegenerated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "https://example.com", "properties": { "additionalProperty": "example" }}