Token endpoint: install codes, partner links, Atlas operator token exchange
https://referalli.com /v1/oauth/token Form-encoded or JSON, three grants. authorization_code: the platform trades the single-use one-click-install code and its PKCE code_verifier for a new signed-protocol connection and its signing secret (returned only here), plus a one-hour access_token scoped connections:write webhooks:write so the platform can require v2 signatures and register its sync webhook; installing again keeps the connection and issues a new secret, the old one verifying for 24 hours; 401 for an unknown, used, expired or mismatched code. client_credentials: a partner link's client_id and client_secret (HTTP Basic or the body), optional scope within the link's, for a one-hour rat_… bearer token. urn:ietf:params:oauth:grant-type:token-exchange (RFC 8693): subject_token = an Atlas operator access token from atlas login (issuer https://atlasauth.net, verified with its discovery document and JWKS, scope atlas:operator), subject_token_type access_token, resource = the org id; the Atlas account must sign in to a Referalli member of that org, and the token gets that role (owner: admin, admin: full, others: read), narrowed by scope. Errors follow RFC 6749 §5.2 ({error, error_description}). No authentication.
Auth: none.
Request body
application/json
Example
{
"grant_type": "string",
"code": "string",
"code_verifier": "string",
"client_id": "string",
"redirect_uri": "string"
}Option 1
grant_typecodecode_verifierclient_idredirect_uri{
"grant_type": "string",
"code": "string",
"code_verifier": "string",
"client_id": "string",
"redirect_uri": "string"
}Option 2
grant_typeclient_idclient_secretscope{
"grant_type": "string",
"client_id": "string",
"client_secret": "string",
"scope": "string"
}Option 3
grant_typesubject_tokensubject_token_typerequested_token_typeaudienceresourcescope{
"grant_type": "string",
"subject_token": "string",
"subject_token_type": "string",
"requested_token_type": "string",
"audience": "string",
"resource": "string",
"scope": "string"
}Code samples
cURL
curl -X POST "https://referalli.com/v1/oauth/token" \
-H "Content-Type: application/json" \
-d '{"grant_type":"string","code":"string","code_verifier":"string","client_id":"string","redirect_uri":"string"}'TypeScript
Python
Go
PHP
Ruby
Java
Responses
Example
{
"token_type": "string",
"connectionId": "string",
"provider": "string",
"instanceId": "string",
"programId": "string",
"secret": "string",
"reinstalled": true,
"signupsUrl": "string",
"partnersUrl": "string",
"eraseUrl": "string",
"exportUrl": "string",
"access_token": "string",
"expires_in": 0,
"scope": "string"
}Option 1
token_typeconnectionIdproviderinstanceIdprogramIdsecretreinstalledsignupsUrlpartnersUrleraseUrlexportUrlaccess_tokenrat_… token for this org, scoped connections:write webhooks:write: require v2 signatures and register the sync webhook.expires_inscope{
"token_type": "string",
"connectionId": "string",
"provider": "string",
"instanceId": "string",
"programId": "string",
"secret": "string",
"reinstalled": true,
"signupsUrl": "string",
"partnersUrl": "string",
"eraseUrl": "string",
"exportUrl": "string",
"access_token": "string",
"expires_in": 0,
"scope": "string"
}Option 2
access_tokenrat_… bearer token (client_credentials or token exchange, REF-S28).token_typeexpires_inscopeissued_token_typeresource{
"access_token": "string",
"token_type": "string",
"expires_in": 0,
"scope": "string",
"issued_token_type": "string",
"resource": "string"
}error.code is one of:Example
{
"error": {
"code": "validation_error",
"message": "the body or query failed validation, an unknown field was sent, the body is not valid json, or a session call has no `x-org-id`",
"details": [
{
"code": "invalid_format",
"path": [
"destinationUrl"
],
"message": "Invalid URL"
}
],
"docs_url": "https://referalli.com/docs/errors-and-limits#validation_error"
}
}{
"error": {
"code": "mode_mismatch",
"message": "the `referalli-mode` header disagrees with the api key's mode",
"docs_url": "https://referalli.com/docs/errors-and-limits#mode_mismatch"
}
}{
"error": {
"code": "bad_request",
"message": "rejected by the http layer before the handler",
"docs_url": "https://referalli.com/docs/errors-and-limits#bad_request"
}
}{
"error": {
"code": "invalid_handoff_token",
"message": "`handofftoken` on `associate` is malformed, expired (24 hours), signed for another org, or its signature does not verify",
"docs_url": "https://referalli.com/docs/errors-and-limits#invalid_handoff_token"
}
}Schema
errorShow child parameters
codemessagedetailsrequestIddocs_urlx-request-idreq_…), matching the server logs. On every response.error.code is one of:Example
{
"error": {
"code": "not_found",
"message": "the resource does not exist in this org (ids from other orgs look the same), a referenced id does not exist, a list cursor is not in the list, or the endpoint does not exist",
"docs_url": "https://referalli.com/docs/errors-and-limits#not_found"
}
}{
"error": {
"code": "not_enrolled",
"message": "the user is not a partner in the program (and the widget's autoenroll is off, or no verified email was given)",
"docs_url": "https://referalli.com/docs/errors-and-limits#not_enrolled"
}
}Schema
errorShow child parameters
codemessagedetailsrequestIddocs_urlx-request-idreq_…), matching the server logs. On every response.error.code is one of:Example
{
"error": {
"code": "rate_limited",
"message": "an endpoint limit or the per-key quota was exceeded",
"docs_url": "https://referalli.com/docs/errors-and-limits#rate_limited"
}
}Schema
errorShow child parameters
codemessagedetailsrequestIddocs_urlx-request-idreq_…), matching the server logs. On every response.Retry-AfterRateLimit-LimitRateLimit-RemainingRateLimit-Reseterror.code is one of:Example
{
"error": {
"code": "internal_error",
"message": "retry with backoff",
"requestId": "req_8f2c1d4e5a6b7c8d",
"docs_url": "https://referalli.com/docs/errors-and-limits#internal_error"
}
}Schema
errorShow child parameters
codemessagedetailsrequestIddocs_urlx-request-idreq_…), matching the server logs. On every response.Example
{
"error": {
"code": "string",
"message": "string",
"details": {},
"requestId": "string",
"docs_url": "string"
}
}Schema
errorShow child parameters
codemessagedetailsrequestIddocs_url