Skip to main content
POST
Exchange authorization code for API keys

Body

application/json
code
string
required

The one-time authorization code from the callback ?code= parameter.

Example:

"abc123def456ghi789jkl012mno345pq"

client_id
string
required

Your application's client identifier.

Example:

"fantastic-storefront"

client_secret
string
required

Your application's client secret. Never send this from a browser.

Example:

"YOUR_CLIENT_SECRET"

redirect_uri
string<uri>
required

Must exactly match the redirect URI used in the original authorization request.

Example:

"https://yourapp.com/callback"

Response

Code exchanged successfully — store the sk securely server-side

A store connection returns the key pair fields (sk, pk, pair_id, store_id, environment, signing_secret, optionally webhook_endpoint). A request with the identity scopes (openid, email, profile) also returns user, and store_role when a store was linked. An identity-only exchange returns just user, scopes and client_id: no keys are issued.

scopes
string[]
required

The permission scopes granted by the merchant.

Example:
client_id
string
required

Your application's client identifier.

Example:

"fantastic-storefront"

user
object

The signed-in person, present when the openid scope was granted. email and email_verified appear with the email scope, name and picture with the profile scope. sub is the stable user id; link accounts on it, never on the email address.

store_role
enum<string>

The person's role on the linked store. Present with user when a store was linked; only the store's owner can link it.

Available options:
owner
Example:

"owner"

sk
string

Secret key. Store this securely server-side — it will not be shown again. Use it for all server-side API calls on behalf of the merchant.

Example:

"tybrite_sk_live_..."

pk
string

Publishable key. Safe to use client-side (browser/mobile). Use it for catalogue reads and the actions a shopper takes for themselves, such as cart and wishlist.

Example:

"tybrite_pk_live_..."

signing_secret
string | null

Request-signing secret for THIS connection. Store it securely server-side alongside the secret key — it will not be shown again. Use it to sign write requests that require a signature (creating/updating orders, initializing payments): set X-Timestamp to the current Unix time and X-Signature to the HMAC-SHA256 of {timestamp}.{request_body} using this secret. Scoped to this connection, so it can be rotated or revoked independently of any other integration.

Example:

"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"

pair_id
string<uuid>

Unique identifier for this key pair. Store it — required to call POST /v1/connect/revoke.

Example:

"550e8400-e29b-41d4-a716-446655440000"

store_id
string<uuid>

The UUID of the store the merchant authorized access to.

Example:

"660f9511-f30c-52e5-b827-557766551111"

environment
enum<string>

Environment the key pair is scoped to.

Available options:
sandbox,
production
Example:

"production"

webhook_endpoint
object

Present only if your application registered a webhook URL. When it did, connecting a merchant automatically creates a signed webhook subscription for their store — you do not need to call createWebhookEndpoint yourself. The subscription starts receiving events immediately.

Verify each inbound event POST with webhook_endpoint.signing_secret (this is a different secret from signing_secret above: signing_secret signs YOUR outbound write requests, while webhook_endpoint.signing_secret verifies Galactic Core's inbound event POSTs to you). The secret is returned only once, here.

Example: