Skip to content

Exchange the code for the user reference

OpenAPI JSON
POST
/connect/token
curl --request POST \
--url https://api.eu.apigami.com/connect/token \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "grant_type": "authorization_code", "code": "q4HcV7yO1c3uXn0mJ2rT8kLwZp5sA6dE9fG0hI1jK2l", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "redirect_uri": "https://example.com/apigami/callback" }'

Your server trades the code the user came back with, within 60 seconds and once, for the user’s user_ref. Send the code_verifier whose challenge opened the connection and the same redirect_uri, character for character. Any failure is invalid_grant and burns the code: start a new connection.

Media typeapplication/json
object
grant_type

Optional; anything else is unsupported_grant_type.

Allowed value: authorization_code
code
required
string
code_verifier
required
string
/^[A-Za-z0-9._~-]{43,128}$/
redirect_uri
required
string format: uri
Example
{
"grant_type": "authorization_code",
"code": "q4HcV7yO1c3uXn0mJ2rT8kLwZp5sA6dE9fG0hI1jK2l",
"code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk",
"redirect_uri": "https://example.com/apigami/callback"
}

The user is connected to your app. Save user_ref; install_ref is the browser the user connected from, or null.

Media typeapplication/json
object
user_ref
required
string
locale
required

The language the person reads Apigami in, which they choose in their account: en, fr, es or de. Write to them in it.

string
Allowed values: en fr es de
identity
required

The person’s name and email, when the version judging declares identity and the person granted it to an application of your group that reaches yours through applications of your group only; or, your application declared optional by an application of another group, once the person authorized its own line there, reached through the two groups only, their email verified, read with your key or from your own page, never in a call from that application; null otherwise. Never in an event. Judged on your production.

object
name
required

The name the person gave, null while they have none: never their email in its place.

string | null
email
required
string format: email
install_ref
required
string | null
installs
required
Array<object>
object
install_ref
required
string
label
required

The name the user gave that browser.

string | null
online
required
boolean
Example
{
"user_ref": "usr_3f9c1a0e7b2d4c58a61e9f0b2d7c4e13",
"locale": "fr",
"identity": null,
"install_ref": "ins_8b1e4f2a9c3d4e5f8a7b6c5d4e3f2a1b",
"installs": [
{
"install_ref": "ins_8b1e4f2a9c3d4e5f8a7b6c5d4e3f2a1b",
"label": null,
"online": true
}
]
}

The code cannot be exchanged.

Media typeapplication/json
object
error
required
string
consentPending

Present and true when the approval window is open and the user has not answered within 45 s.

boolean
permission

On consent requested and no grant from emails.send or ai.generate: the permission the user never decided, or refused. Absent for a site.

string
Allowed values: emails ai
settings_url

On no grant: the page of the user’s Apigami space where they allow it again; send them there.

string format: uri
terms

On consent requested, in place of permission: the bare app_id of each application whose terms or subprocessors the user has yet to agree to, unlike the boxes of GET /apps/{app_id}. Only the connect page asks it: send them to connect_url, or to one of your pages.

Array<string>
connect_url

With terms, when the user agrees under your application: your install link, where they tick the boxes still to tick.

string format: uri
Examples
{
"error": "invalid_grant"
}

Missing, malformed or revoked API key.

Media typeapplication/json
object
error
required
string
consentPending

Present and true when the approval window is open and the user has not answered within 45 s.

boolean
permission

On consent requested and no grant from emails.send or ai.generate: the permission the user never decided, or refused. Absent for a site.

string
Allowed values: emails ai
settings_url

On no grant: the page of the user’s Apigami space where they allow it again; send them there.

string format: uri
terms

On consent requested, in place of permission: the bare app_id of each application whose terms or subprocessors the user has yet to agree to, unlike the boxes of GET /apps/{app_id}. Only the connect page asks it: send them to connect_url, or to one of your pages.

Array<string>
connect_url

With terms, when the user agrees under your application: your install link, where they tick the boxes still to tick.

string format: uri
Example
{
"error": "bad client credentials"
}