Platform API
Reference for The Grid Platform API at cortex.thegrid.ai. OAuth 2.0 device login for agents, programmatic consumption and trading key management, and account settings endpoints with full request and r
How the Platform API fits with the other APIs
OAuth
Lists all platform scopes. Pass client_id to see only the scopes a registered OAuth application may request. No authentication required.
grid-cli-publicScope catalog
Unknown client_id
Starts the device authorization flow. The user approves the listed scopes at verification_uri.
grid-cli-publicaccount:read account:write keys:manageDevice authorization created
https://app.thegrid.ai/activateSeconds until the device code expires
Minimum seconds between token polls
Device authorization created
Poll with grant_type urn:ietf:params:oauth:grant-type:device_code until the user approves, or refresh an expired access token with grant_type refresh_token.
While polling, a 400 response carries an OAuthError body. Handle each error code distinctly: authorization_pending (keep polling at interval), slow_down (increase the interval by 5 seconds, then keep polling), access_denied (user declined; stop), and expired_token (device code expired; restart the device flow). Any other error (e.g. invalid_grant) is terminal.
Refresh tokens may rotate: persist whatever refresh_token comes back in the response and discard the previous one. Refresh about 60 seconds before expires_in elapses to absorb clock skew, and on a 401/403 invalid_token from a resource endpoint, refresh once and retry.
Required for the device_code grant
Required for the refresh_token grant
Token pair issued
Bearer token, prefixed grid_at_
Refresh token, prefixed grid_rt_
BearerAccess token lifetime in seconds (3600)
account:read keys:managePolling or refresh error. The error field is one of authorization_pending, slow_down, access_denied, expired_token, or invalid_grant.
Revokes an access or refresh token. Send a JSON body with the token to revoke. token_type_hint is optional and client_id is not required. Always returns 200 with an empty body, even for unknown or already-revoked tokens, so a 200 is not proof the token existed.
An access token (grid_at_) or refresh token (grid_rt_)
Optional RFC 7009 hint. Accepted but not required.
Revoked (or unknown token, per RFC 7009). Body is empty ({}).
No content
Revoked (or unknown token, per RFC 7009). Body is empty ({}).
No content
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Grants for the authenticated user
Authentication required
Revokes the grant and invalidates its tokens.
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Grant revoked
No content
Grant not found
No content
Consumption API keys
Raw secrets are never returned on list. Requires the keys:manage scope.
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Keys with key set to null and key_prefix populated
Keys with key set to null and key_prefix populated
The raw secret is returned once in data.key. Store it immediately. Requires the keys:manage scope.
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Key created, raw secret in data.key
Key created, raw secret in data.key
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Key metadata, raw secret not included
No content
Key metadata, raw secret not included
No content
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Updated
No content
Updated
No content
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Revoked
No content
Revoked
No content
Trading signing keys
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Registered Ed25519 public keys
Registered Ed25519 public keys
Generate the keypair locally; only the public key is registered. The private key never leaves your machine. Requires the keys:manage scope.
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Registered. Response includes the fingerprint used as x-thegrid-fingerprint.
No content
Invalid public key
No content
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Revoked
No content
Revoked
No content
Account settings
Returns account mode and funding automation settings. Fields listed in mode_managed_fields are dictated by the account mode and are read-only through this API. Requires the account:read scope.
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Current settings
Current settings
Switches between auto (easy) and advanced mode. Switching back to easy fails with 409 while open orders exist. Requires the account:write scope, a verified user, accepted legal terms, and an active account.
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Mode switched
No content
Already in the requested mode, or open orders block the switch
Missing or invalid mode
No content
Idempotent. auto_buy_enabled is mode-managed: the account mode dictates its value, so only the dictated value is accepted; anything else returns 403 mode_managed_setting. Requires the account:write scope.
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Current settings, same shape as GET
No content
Value diverges from the mode-dictated value (mode_managed_setting)
No content
Updates only auto_reload_* fields. Enabling auto-reload requires both USD fields, in the request or already stored. Requires the account:write scope.
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
10100500Current settings, same shape as GET
No content
Validation error (missing USD fields, invalid ranges, limit below amount)
No content
auto_transfer_enabled is mode-managed: only the value dictated by the account mode is accepted (403 mode_managed_setting otherwise). Send auto_transfer_override null to clear a stored override and follow the platform default. Requires the account:write scope.
OAuth access token issued by the device or authorization-code flow. Tokens are prefixed grid_at_. Each endpoint lists the scope it requires.
Current settings, same shape as GET
No content
Value diverges from the mode-dictated value (mode_managed_setting)
No content
Where next
Last updated
Was this helpful?