SynqDocs
Management APIClaimable orgs

Claim a claimable org into an org you have, as a brand

The other way to claim what `npx synqauth init` made: instead of becoming an org of its own, its brand joins `org`, an org the caller owns or is an admin of, as a new brand, with its apps, keys and users. Its id, issuer, client ids, secrets and signing keys stay the same, so the app's `.env.local` keeps working and its users stay signed in; its development limits go, and the org's plan's apply. The development org, left with no brand, closes: deleted, and purged 30 days on. `POST /v1/claimable-orgs/lookup` lists the orgs it can join (`into_orgs`). A person only, the org's owner or an admin (`forbidden` otherwise; an org they aren't a member of is `not_found`), with the claim token, and with room under the org's plan for another brand (`plan_quota_exceeded`, naming the org, its plan and the one with room). A person needs a sign-in at Synq from the last 5 minutes whose time Synq proved (send them to sign in with `max_age=300`), else 403 `fresh_sign_in_required`; an API key never does. The token works once: a used or expired one is `not_found`. Recorded in the org's log as `brand.claimed` (from `npx synqauth init`), also the event of its All brands endpoints, and in the development org's as `org.deleted` (`reason: claimed_into_org`).

POST/v1/claimable-orgs/claim-into

The other way to claim what npx synqauth init made: instead of becoming an org of its own, its brand joins org, an org the caller owns or is an admin of, as a new brand, with its apps, keys and users. Its id, issuer, client ids, secrets and signing keys stay the same, so the app's .env.local keeps working and its users stay signed in; its development limits go, and the org's plan's apply. The development org, left with no brand, closes: deleted, and purged 30 days on. POST /v1/claimable-orgs/lookup lists the orgs it can join (into_orgs).

A person only, the org's owner or an admin (forbidden otherwise; an org they aren't a member of is not_found), with the claim token, and with room under the org's plan for another brand (plan_quota_exceeded, naming the org, its plan and the one with room). A person needs a sign-in at Synq from the last 5 minutes whose time Synq proved (send them to sign in with max_age=300), else 403 fresh_sign_in_required; an API key never does. The token works once: a used or expired one is not_found. Recorded in the org's log as brand.claimed (from npx synqauth init), also the event of its All brands endpoints, and in the development org's as org.deleted (reason: claimed_into_org).

Authorization

bearer
AuthorizationBearer <token>

An org API key (sk_live_…, sk_test_…), or an access token from the Synq issuer (the synq brand, on the accounts host) for this API.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X POST "https://api.synq.build/v1/claimable-orgs/claim-into" \  -H "Authorization: Bearer $SYNQ_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "claim_token": "synq_claim_…",    "org": "org_01h455vb4pex5vsknk084sn02q"  }'
{  "org": {    "id": "org_01h455vb4pex5vsknk084sn02q",    "slug": "acme",    "name": "Acme"  },  "brand": {    "id": "brd_01h455vb4pex5vsknk084sn02q",    "name": "acme-web",    "issuer_slug": "dev-k3v9q2m7xa",    "issuer": "https://dev-k3v9q2m7xa.auth.synq.build",    "is_default": false  },  "development_org": {    "id": "org_01h455vb4pex5vsknk084sn02r",    "slug": "dev-k3v9q2m7xa"  }}