API documentation
View as Markdown

OAuth API

Start OAuth authorization

Validates the application, exact redirect URI, requested granular scopes, state, and PKCE S256 challenge, then sends the browser to Demarky consent.

GET/oauth/authorize

Authentication

No authentication required.

Parameters

NameInTypeRequiredDescription
client_idquerystringYesPublic identifier of the registered partner application. An unknown client is reported directly as a 400 instead of redirected.
redirect_uriquerystringYesMust match one of the redirect URIs registered for the application exactly, including scheme, host, port, and path. A mismatch is reported directly as a 400 instead of redirected.
response_typequerystringYesConstant code. Only the authorization code flow is supported; any other value redirects back with error=unsupported_response_type.
scopequerystringYesSpace-separated granular scopes to request. At least one is required, every value must be one of: products:read, products:write, pages:read, pages:write, pages:deploy, leads:read, leads:write, and the set must be within the scopes the application itself is registered for. Duplicates are collapsed, and anything unknown or beyond the application registration redirects back with error=invalid_scope.
statequerystringYesOpaque CSRF value returned unchanged on the redirect back to redirect_uri, on both success and error. Must be at least 16 characters; 22 or more of base64url randomness is recommended. A missing or too-short value redirects back with error=invalid_request and no state.
code_challengequerystringYesPKCE challenge: the base64url-encoded SHA-256 of the code verifier, 43 to 128 characters from [A-Za-z0-9_-]. A malformed value redirects back with error=invalid_request.
code_challenge_methodquerystringYesConstant S256. Plain PKCE is not accepted; any other value redirects back with error=invalid_request.

cURL example

curl -X GET "https://api.demarky.ai/oauth/authorize?client_id=app_0123456789abcdefghjkmnpqrs&redirect_uri=https%3A%2F%2Fpartner.example%2Foauth%2Fcallback&response_type=code&scope=products%3Aread%20pages%3Awrite&state=ac9f7e2b13c84f0f&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256"

Returns the application name, target account, and exact requested scopes for an active pending authorization request. It never returns credentials or authorization codes.

GET/v1/oauth/authorize/request

Authentication

Requires bearer authentication.

Parameters

NameInTypeRequiredDescription
requestquerystringYes

cURL example

curl -X GET https://api.demarky.ai/v1/oauth/authorize/request \
  -H "Authorization: Bearer dmk_at_live_xxx"

Approves or denies a pending authorization request using the logged-in account owner session.

POST/v1/oauth/authorize/decision

Authentication

Requires bearer authentication.

Request body

This request body is required.

FieldTypeRequiredNotes
requeststringYes
approvebooleanYes

The example below includes optional fields for context; only fields marked Yes are always required. Conditional requirements are listed in Notes.

cURL example

curl -X POST https://api.demarky.ai/v1/oauth/authorize/decision \
  -H "Authorization: Bearer dmk_at_live_xxx"

Exchange or refresh OAuth tokens

Exchanges a single-use authorization code with PKCE or rotates a refresh token. Clients authenticate with HTTP Basic or form credentials.

POST/oauth/token

Authentication

Requires HTTP Basic application authentication.

Request body

This request body is required.

FieldTypeRequiredNotes
grant_typestringYesAllowed: authorization_code, refresh_token
codestringNo
redirect_uristring (uri)No
code_verifierstringNo
refresh_tokenstringNo
scopestringNo
client_idstringNo
client_secretstring (password)No

The example below includes optional fields for context; only fields marked Yes are always required. Conditional requirements are listed in Notes.

{
  "grant_type": "authorization_code",
  "code": "dmk_ac_live_replace_me",
  "redirect_uri": "https://partner.example/oauth/callback",
  "code_verifier": "replace_with_the_original_pkce_code_verifier"
}

cURL example

curl -X POST https://api.demarky.ai/oauth/token \
  -u "app_0123456789abcdefghjkmnpqrs:dmk_cs_live_xxx"

Revoke an OAuth token

Revokes one access token or an entire refresh-token family. Unknown tokens also return 200.

POST/oauth/revoke

Authentication

Requires HTTP Basic application authentication.

Request body

This request body is required.

FieldTypeRequiredNotes
tokenstringYes
token_type_hintstringNoAllowed: access_token, refresh_token
client_idstringNo
client_secretstring (password)No

The example below includes optional fields for context; only fields marked Yes are always required. Conditional requirements are listed in Notes.

{
  "token": "dmk_at_live_replace_me",
  "token_type_hint": "access_token"
}

cURL example

curl -X POST https://api.demarky.ai/oauth/revoke \
  -u "app_0123456789abcdefghjkmnpqrs:dmk_cs_live_xxx"