Set or clear an organization's parent
const url = 'https://quikstik-core.fly.dev/organizations/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/parent';const options = { method: 'POST', headers: { 'x-tenant-id': '2489E9AD-2EE2-8E00-8EC9-32D5F69181C0', 'Idempotency-Key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"parent_org_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://quikstik-core.fly.dev/organizations/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/parent \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: example' \ --header 'x-tenant-id: 2489E9AD-2EE2-8E00-8EC9-32D5F69181C0' \ --data '{ "parent_org_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'Re-parents an Organization. A null parent_org_id makes it a root. A cross-tenant parent or
a parent that would introduce a cycle (including self-parent) is rejected (409).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Tenant identifier (UUID).
Authn/authz semantics are intentionally TBD for this contract slice; this header exists to keep the contract explicitly multi-tenant from day 0.
Idempotency key for the command envelope. A retry with the same key is a no-op.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Null makes the organization a root.
Example generated
{ "parent_org_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Responses
Section titled “Responses”Re-parent accepted
object
Example generated
{ "org_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Malformed body
object
Example generated
{ "reason": "example"}Missing or invalid session bearer token
object
Stable, machine-readable reason code (e.g. “sold_out”, “processor_not_configured”, “rail_refused”).
Example
{ "reason": "sold_out"}The session’s effect authority does not cover this operation
object
Stable, machine-readable reason code (e.g. “sold_out”, “processor_not_configured”, “rail_refused”).
Example
{ "reason": "sold_out"}Expired, consumed, unknown, or unresolvable — indistinguishable by design
object
Example generated
{ "reason": "example"}The change is rejected by a domain invariant (e.g. a hierarchy cycle)
object
Stable machine-readable error code
Human-readable explanation (never leaks SQL, URLs, or secrets)
Example generated
{ "code": "example", "message": "example"}No durable backend is wired for this operation (fail-closed)
object
Stable, machine-readable reason code (e.g. “sold_out”, “processor_not_configured”, “rail_refused”).
Example
{ "reason": "sold_out"}