Agnic
API Reference

O Auth

OAuth 2.0 authentication flow

GET/oauth/authorize

Start OAuth Authorization

Start the OAuth 2.0 authorization code flow. Redirect users to this endpoint to request permission to make payments on their behalf.

query parameters

NameTypeDescription
client_id*stringYour application identifier
example: "my-app"
redirect_uri*string<uri>URL to redirect after authorization
state*stringCSRF protection token (returned unchanged)
scopestring
default: "payments:sign balance:read"
Space-separated scopes
response_type*"code"Must be "code"
code_challengestringPKCE code challenge (recommended)
code_challenge_method"S256"
default: "S256"
PKCE method
prompt"none" | "consent" | "login"Controls consent behavior: - `none`: Silent auth only (error if consent needed) - `consent`: Force consent screen - `login`: Force re-authentication

Responses

302Redirect to consent page or callback
400Invalid request parameters

Example (cURL)

curl -X GET 'https://api.agnic.ai/oauth/authorize?client_id=my-app&redirect_uri=%3Cvalue%3E&state=%3Cvalue%3E&response_type=%3Cvalue%3E' \
  -H 'X-Agnic-Token: YOUR_TOKEN'
POST/oauth/token

Exchange Tokens

Exchange authorization code for access token, or refresh an access token.

Request body *

oneOf
FieldTypeDescription
grant_type*"authorization_code"
code*string
redirect_uri*string<uri>
client_id*string
code_verifierstring
PKCE code verifier
FieldTypeDescription
grant_type*"refresh_token"
refresh_token*string

Responses

200Tokens issued successfully
FieldTypeDescription
access_tokenstring
refresh_tokenstring
token_typestring
example: "Bearer"
expires_ininteger
Seconds until expiration
scopestring
400Invalid grant

Example (cURL)

curl -X POST 'https://api.agnic.ai/oauth/token' \
  -H 'X-Agnic-Token: YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"key":"value"}'
GET/.well-known/oauth-authorization-server

OAuth Server Metadata

OAuth 2.0 Authorization Server Metadata (RFC 8414)

Responses

200Server metadata
FieldTypeDescription
issuerstring
authorization_endpointstring
token_endpointstring
scopes_supportedstring[]
show nested schema
array of
string
response_types_supportedstring[]
show nested schema
array of
string
grant_types_supportedstring[]
show nested schema
array of
string

Example (cURL)

curl -X GET 'https://api.agnic.ai/.well-known/oauth-authorization-server' \
  -H 'X-Agnic-Token: YOUR_TOKEN'