SynqDocs
Management APISetup codes

Set a project up with a setup code

What `npx synqauth init --code <code>` calls, with no credential but the code (`POST …/apps/{app}/setup-code` made it): the app gets the project's https loopback redirect and post-logout URIs it lacks (`app.updated`), up to the 20 an app holds, and a new secret (`app.secret_rotated`), both recorded as the person who made the code. The secret it had keeps working for a day, as a rotation's does. The answer is the brand's issuer and the app's keys, for the project's `.env.local`, this once. The code works once, within 60 minutes, and only while whoever made it may still change the app: a used, expired or unknown one, one whose app, brand or org is gone or disabled, or one whose maker left the org, was removed, lost `org.apps.edit` or had their sessions there ended (an API key: was revoked or expired) is `not_found`. An app that can't be set up now (not a web app with a secret, not the brand's own, turned off) is `conflict`, and the code stays unused.

POST/v1/setup-codes/redeem

What npx synqauth init --code <code> calls, with no credential but the code (POST …/apps/{app}/setup-code made it): the app gets the project's https loopback redirect and post-logout URIs it lacks (app.updated), up to the 20 an app holds, and a new secret (app.secret_rotated), both recorded as the person who made the code. The secret it had keeps working for a day, as a rotation's does. The answer is the brand's issuer and the app's keys, for the project's .env.local, this once.

The code works once, within 60 minutes, and only while whoever made it may still change the app: a used, expired or unknown one, one whose app, brand or org is gone or disabled, or one whose maker left the org, was removed, lost org.apps.edit or had their sessions there ended (an API key: was revoked or expired) is not_found. An app that can't be set up now (not a web app with a secret, not the brand's own, turned off) is conflict, and the code stays unused.

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

curl -X POST "https://api.synq.build/v1/setup-codes/redeem" \  -H "Authorization: Bearer $SYNQ_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "code": "synq_setup_…",    "redirect_uris": [      "https://localhost:3000/api/auth/callback"    ],    "post_logout_redirect_uris": []  }'
{  "org": {    "id": "org_01h455vb4pex5vsknk084sn02q",    "slug": "acme",    "name": "Acme"  },  "brand": {    "id": "string",    "name": "Acme"  },  "issuer": "https://acme.auth.synq.build",  "app": {    "client_id": "app_01h455vb4pex5vsknk084sn02q",    "client_secret": "string",    "name": "Acme",    "redirect_uris": [      "https://app.acme.example"    ]  }}