Aries Financial O Auth2 API

OAuth2 token issuance: exchange authorization codes, refresh tokens, or client credentials for access tokens

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 1

POST /v1/oauth2/token Exchange OAuth2 code or refresh token #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/finance-dev:finance-dev-oauth2-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

finance-dev-oauth2-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact:
    email: support@aries.com
    name: Aries Financial
  description: 'OpenAPI Specification for the Aries trading platform API. # Authentication


    Learn how to authenticate with the Aries API using OAuth2 and manage access tokens in your SDK. ## Overview


    The Aries API uses **OAuth2 with Bearer tokens** (JWT format) for authentication. All API requests require a valid access token in the `Authorization` header:


    ```

    Authorization: Bearer

    ```


    ## Providing Client ID and Client Secret (SDK)


    When using the generated SDK, provide your **Client ID** and **Client Secret** when you create the API client (e.g. in the constructor or security options). The SDK will use these to obtain and refresh the access token internally; you do not need to manage tokens yourself. Obtain your OAuth2 credentials from the Aries platform (e.g. Client Center / Manage Account at https://app.aries.com):


    - **Client ID** – Your application identifier (pass to SDK client)

    - **Client Secret** – Your application secret key (pass to SDK client; use PKCE for public clients where secret cannot be stored)


    ## Authentication Flow


    ### 1. Authorization Code Flow


    For server-side or confidential clients:


    1. **Redirect the user** to the authorization URL to sign in and consent:

    - **URL:** `https://app.aries.com/oauth2/authorize`

    - **Query params:** `response_type=code`, `client_id`, `redirect_uri`, `scope`, `state`


    2. **Exchange the code for tokens** (after user is redirected back with `?code=.`):

    - **POST** `https://api.aries.com/v1/oauth2/token`

    - **Body:** `grant_type=authorization_code`, `code`, `redirect_uri`, `client_id`, `client_secret`

    - Response includes `access_token` and `refresh_token`


    3. **Call the API** with the access token: `Authorization: Bearer `


    ### 2. PKCE Flow


    For SPAs and mobile apps (public clients that cannot store `client_secret`):


    1. Generate a **code_verifier** (random string) and **code_challenge** = BASE64URL(SHA256(code_verifier)). 2. **Redirect the user** to `https://app.aries.com/oauth2/authorize` with `code_challenge`, `code_challenge_method=S256`, plus `client_id`, `redirect_uri`, `scope`, `state`. 3. **Exchange the code** at POST `https://api.aries.com/v1/oauth2/token` with `grant_type=authorization_code`, `code`, `redirect_uri`, `client_id`, `code_verifier` (no client_secret). 4. Use the returned `access_token` as Bearer. ### 3. MFA Verification


    If the user has MFA enabled, the authorize step may return `is_mfa: true` and a `next_step_auth_id`. Call **POST** `https://api.aries.com/v1/oauth2/authorize/mfa` with `next_step_auth_id` and `verification_code` (6-digit code). Then continue with **POST** `/v1/oauth2/authorize/confirm` to get the authorization code, and exchange it at `/v1/oauth2/token`. ## Token Management


    - **Refresh when expired:** POST `https://api.aries.com/v1/oauth2/token` with `grant_type=refresh_token`, `client_id`, `client_secret`, `refresh_token`. - **Using a Bearer token directly:** If you already have an access token, set the header `Authorization: Bearer ` on every request. The SDK can accept a pre-obtained token and use it until it expires. ## OAuth2 Scopes


    Request only the scopes your application needs.'
  title: Aries API — OpenAPI Specification O Auth2 API
  version: 1.0.0
servers:
- description: Production server
  url: https://api.aries.com
- description: Staging server
  url: https://api.tradearies.dev
tags:
- description: 'OAuth2 token issuance: exchange authorization codes, refresh tokens, or client credentials for access tokens'
  name: OAuth2
paths:
  /v1/oauth2/token:
    post:
      description: Exchanges an authorization code for access and refresh tokens, exchanges a PKCE authorization code using a `code_verifier`, or refreshes an existing access token using a refresh token. This endpoint issues tokens and does not require an existing Bearer token. Also supports client_credentials. JSON code exchanges use grant_type=code; form-encoded exchanges also accept authorization_code. Code exchange accepts a client secret, a PKCE verifier, or both.
      operationId: createOAuth2Token
      requestBody:
        content:
          application/json:
            examples:
              authorizationCode:
                summary: Authorization Code
                value:
                  client_id: client_abc123xyz
                  client_secret: secret_xyz789abc
                  code: auth_code_abc123xyz789def456
                  grant_type: code
                  redirect_uri: https://yourapp.com/callback
              clientCredentials:
                summary: Client Credentials
                value:
                  client_id: client_abc123xyz
                  client_secret: secret_xyz789abc
                  grant_type: client_credentials
              pkce:
                summary: PKCE
                value:
                  client_id: client_abc123xyz
                  code: auth_code_abc123xyz789def456
                  code_verifier: verifier_abc123xyz789def456
                  grant_type: code
                  redirect_uri: https://yourapp.com/callback
              refreshToken:
                summary: Refresh Token
                value:
                  client_id: client_abc123xyz
                  client_secret: secret_xyz789abc
                  grant_type: refresh_token
                  refresh_token: refresh_token_abc123xyz789def456
            schema:
              oneOf:
              - anyOf:
                - $ref: '#/components/schemas/OAuth2TokenAuthorizationCodeRequest'
                - $ref: '#/components/schemas/OAuth2TokenPkceRequest'
              - $ref: '#/components/schemas/OAuth2TokenRefreshRequest'
              - $ref: '#/components/schemas/OAuth2TokenClientCredentialsRequest'
          application/x-www-form-urlencoded:
            schema:
              oneOf:
              - anyOf:
                - $ref: '#/components/schemas/OAuth2TokenFormAuthorizationCodeRequest'
                - $ref: '#/components/schemas/OAuth2TokenFormPkceRequest'
              - $ref: '#/components/schemas/OAuth2TokenRefreshRequest'
              - $ref: '#/components/schemas/OAuth2TokenClientCredentialsRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              example:
                access_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.signature
                expires_in: 3600
                refresh_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyZWYiOiIxMjM0NTY3ODkwIn0.signature
                refresh_token_expires_in: 31536000
                scope: account:information order:execution
                token_type: Bearer
              schema:
                $ref: '#/components/schemas/OAuth2TokenResponse'
          description: Tokens issued successfully
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security: []
      summary: Exchange OAuth2 code or refresh token
      tags:
      - OAuth2
components:
  schemas:
    AuthenticationErrorEnvelope:
      description: JSON envelope where `error` is a nested object (`type`, `code`, `message`, …). Many services use this shape for 400, 401, 403, 404, and 5xx when using the shared HTTP error format.
      properties:
        error:
          $ref: '#/components/schemas/AuthenticationErrorDetail'
        meta:
          additionalProperties: true
          description: Optional metadata
          type: object
      type: object
    OAuth2TokenResponse:
      description: OAuth2 token response. All fields are always present. For client_credentials, `refresh_token` is empty and `refresh_token_expires_in` is 0.
      properties:
        access_token:
          description: OAuth2 access token used in the Authorization header.
          type: string
        expires_in:
          description: Access token lifetime in seconds. 3600 for code and refresh_token grants; server-configured for client_credentials.
          example: 3600
          type: integer
        refresh_token:
          description: Refresh token used to obtain a new access token later. Empty for client_credentials.
          type: string
        refresh_token_expires_in:
          description: Refresh token lifetime in seconds. 0 for client_credentials.
          example: 31536000
          type: integer
        scope:
          description: Space-separated scopes granted for this token.
          example: account:information order:execution
          type: string
        token_type:
          description: Token type. Always Bearer.
          enum:
          - Bearer
          example: Bearer
          type: string
      required:
      - access_token
      - refresh_token
      - token_type
      - expires_in
      - refresh_token_expires_in
      - scope
      type: object
    OAuth2TokenAuthorizationCodeRequest:
      description: Use this when your app has a backend server and can safely store a client secret. Exchange a one-time authorization code for tokens by sending `client_secret`.
      properties:
        client_id:
          description: OAuth2 client identifier.
          minLength: 1
          type: string
        client_secret:
          description: OAuth2 client secret for confidential server-side apps.
          minLength: 1
          type: string
        code:
          description: Authorization code returned from the authorize or confirm flow.
          minLength: 1
          type: string
        grant_type:
          description: Use code in JSON. Form-encoded requests also accept authorization_code.
          enum:
          - code
          example: code
          minLength: 1
          type: string
        redirect_uri:
          description: Redirect URI used earlier in the login flow. Must match exactly.
          example: https://yourapp.com/callback
          minLength: 1
          type: string
      required:
      - client_id
      - client_secret
      - code
      - grant_type
      - redirect_uri
      title: Authorization Code
      type: object
    AuthenticationErrorDetail:
      description: Structured payload for the nested `error` object. Services using the shared Go error writer emit uppercase `type` values aligned with error categories (for example `VALIDATION`, `BAD_REQUEST`, `AUTHENTICATION`, `AUTHORIZATION`, `NOT_FOUND`, `RATE_LIMIT`, `INTERNAL`).
      properties:
        code:
          description: Machine-readable code
          example: INVALID_TOKEN
          type: string
        details:
          additionalProperties: true
          description: Optional extra context
          type: object
        message:
          description: Error detail as a string. Exact message content is not fixed and should not be hard-coded.
          example: string
          type: string
        request_id:
          description: Request correlation id when provided
          type: string
        type:
          description: Error category emitted by the shared error writer, such as VALIDATION, BAD_REQUEST, AUTHENTICATION, AUTHORIZATION, NOT_FOUND, RATE_LIMIT, or INTERNAL.
          example: AUTHENTICATION
          type: string
      type: object
    OAuth2TokenClientCredentialsRequest:
      description: Use this to obtain an access token for an API client owned by a user. Partner clients are rejected with 403 and must use the authorization code flow. No refresh token is issued.
      properties:
        client_id:
          description: OAuth2 client identifier.
          minLength: 1
          type: string
        client_secret:
          description: OAuth2 client secret.
          minLength: 1
          type: string
        grant_type:
          description: Grant type for obtaining an access token with client credentials.
          enum:
          - client_credentials
          example: client_credentials
          minLength: 1
          type: string
      required:
      - client_id
      - client_secret
      - grant_type
      title: Client Credentials
      type: object
    OAuth2TokenPkceRequest:
      description: Use this when your app runs in the browser or on a mobile device and cannot safely store a client secret. Exchange a one-time authorization code by sending `code_verifier` instead of `client_secret`.
      properties:
        client_id:
          description: OAuth2 client identifier.
          minLength: 1
          type: string
        code:
          description: Authorization code returned from the authorize or confirm flow.
          minLength: 1
          type: string
        code_verifier:
          description: Original PKCE verifier generated by your app before redirecting the user.
          minLength: 1
          type: string
        grant_type:
          description: Use code in JSON. Form-encoded requests also accept authorization_code.
          enum:
          - code
          example: code
          minLength: 1
          type: string
        redirect_uri:
          description: Redirect URI used earlier in the login flow. Must match exactly.
          example: https://yourapp.com/callback
          minLength: 1
          type: string
      required:
      - client_id
      - code
      - grant_type
      - redirect_uri
      - code_verifier
      title: PKCE
      type: object
    ErrorCode:
      description: A single structured error entry identifying a machine-readable code, a human-readable description, and optionally the field that caused it.
      properties:
        code:
          description: Machine-readable error code
          example: INVALID_PASSWORD
          type: string
        description:
          description: Human-readable description of the error
          example: Password must be between 8 and 64 characters
          type: string
        field:
          description: Field name that caused the error
          example: password
          type: string
      type: object
    OAuth2TokenRefreshRequest:
      description: Use this after you already have tokens and only need a fresh access token. Send the refresh token previously issued by Aries.
      properties:
        client_id:
          description: OAuth2 client identifier.
          minLength: 1
          type: string
        client_secret:
          description: Optional. Accepted for compatibility but not used to validate refresh requests.
          type: string
        grant_type:
          description: Grant type for refreshing an expired access token.
          enum:
          - refresh_token
          example: refresh_token
          minLength: 1
          type: string
        refresh_token:
          description: Refresh token previously issued by Aries.
          minLength: 1
          type: string
      required:
      - client_id
      - grant_type
      - refresh_token
      title: Refresh Token
      type: object
    OAuth2TokenFormAuthorizationCodeRequest:
      description: Use this when your app has a backend server and can safely store a client secret. Exchange a one-time authorization code for tokens by sending `client_secret`.
      properties:
        client_id:
          description: OAuth2 client identifier.
          minLength: 1
          type: string
        client_secret:
          description: OAuth2 client secret for confidential server-side apps.
          minLength: 1
          type: string
        code:
          description: Authorization code returned from the authorize or confirm flow.
          minLength: 1
          type: string
        grant_type:
          description: Use code in JSON. Form-encoded requests also accept authorization_code.
          enum:
          - code
          - authorization_code
          example: code
          minLength: 1
          type: string
        redirect_uri:
          description: Redirect URI used earlier in the login flow. Must match exactly.
          example: https://yourapp.com/callback
          minLength: 1
          type: string
      required:
      - client_id
      - client_secret
      - code
      - grant_type
      - redirect_uri
      title: Authorization Code
      type: object
    ErrorResponse:
      description: 'Flat error body: an `error` string, with optional structured `codes` and additional `metadata`.'
      properties:
        codes:
          description: Structured error codes for programmatic handling
          items:
            $ref: '#/components/schemas/ErrorCode'
          type: array
        error:
          description: Error detail as a string. Exact message content is not fixed and should not be hard-coded.
          example: string
          type: string
        metadata:
          additionalProperties: true
          description: Additional error context
          type: object
      type: object
    OAuth2TokenFormPkceRequest:
      description: Use this when your app runs in the browser or on a mobile device and cannot safely store a client secret. Exchange a one-time authorization code by sending `code_verifier` instead of `client_secret`.
      properties:
        client_id:
          description: OAuth2 client identifier.
          minLength: 1
          type: string
        code:
          description: Authorization code returned from the authorize or confirm flow.
          minLength: 1
          type: string
        code_verifier:
          description: Original PKCE verifier generated by your app before redirecting the user.
          minLength: 1
          type: string
        grant_type:
          description: Use code in JSON. Form-encoded requests also accept authorization_code.
          enum:
          - code
          - authorization_code
          example: code
          minLength: 1
          type: string
        redirect_uri:
          description: Redirect URI used earlier in the login flow. Must match exactly.
          example: https://yourapp.com/callback
          minLength: 1
          type: string
      required:
      - client_id
      - code
      - grant_type
      - redirect_uri
      - code_verifier
      title: PKCE
      type: object
  responses:
    BadRequest:
      content:
        application/json:
          examples:
            flat_string:
              summary: Flat error string
              value:
                error: string
            flat_with_codes:
              summary: Flat error with field codes (some services)
              value:
                codes:
                - code: string
                  description: string
                  field: string
                error: string
            nested_bad_request:
              summary: Nested error (BAD_REQUEST / invalid JSON)
              value:
                error:
                  code: INVALID_JSON
                  message: string
                  type: BAD_REQUEST
            nested_shared_http_error:
              summary: Nested error (typical for shared WriteHTTPError-style responses)
              value:
                error:
                  code: VALIDATION_ERROR
                  details:
                    fieldName: field is required
                  message: Query parameter validation failed
                  type: VALIDATION
          schema:
            description: 400 responses commonly use a nested `error` object (`type`, `code`, `message`, optional `details`). Some services still return flat `ErrorResponse` (`error` string, optional `codes`).
            oneOf:
            - $ref: '#/components/schemas/AuthenticationErrorEnvelope'
            - $ref: '#/components/schemas/ErrorResponse'
      description: 'Invalid query/path/body, malformed JSON, or failed validation.


        **Backend (shared HTTP errors):** Routes that use the shared error writer typically return a **nested** JSON object: `error.type` is an uppercase category such as `VALIDATION` or `BAD_REQUEST` (see the API implementation). Other routes may return the **flat** `ErrorResponse` shape (`error` as a string, optional `codes`). The body may rarely be empty.


        **OpenAPI:** Every operation’s **400** response references this component so the documented schema and examples stay aligned.'
    Forbidden:
      content:
        application/json:
          examples:
            flat:
              summary: Flat message
              value:
                error: string
            nested:
              summary: Nested error (shared HTTP error format)
              value:
                error:
                  code: INSUFFICIENT_SCOPE
                  message: string
                  type: AUTHORIZATION
          schema:
            description: 403 responses may use a flat or nested error shape.
            oneOf:
            - $ref: '#/components/schemas/ErrorResponse'
            - $ref: '#/components/schemas/AuthenticationErrorEnvelope'
      description: 'Authenticated but not allowed to perform this action or access this resource (insufficient scope or role).


        **Response body variants:** Flat `ErrorResponse` or nested `error` object, same pattern as 400/401.'
    Unauthorized:
      content:
        application/json:
          examples:
            flat_message:
              summary: Flat error string (typical)
              value:
                error: string
            flat_with_codes:
              summary: Flat error with structured codes
              value:
                codes:
                - code: string
                  description: string
                error: string
            nested_error_object:
              summary: Nested error (shared HTTP error format)
              value:
                error:
                  code: INVALID_TOKEN
                  message: string
                  type: AUTHENTICATION
          schema:
            description: '401 responses may use a flat `ErrorResponse` shape or a nested `error` object. Inspect `error`: if it is a string, use the flat shape; if it is an object, use the structured shape.'
            oneOf:
            - $ref: '#/components/schemas/ErrorResponse'
            - $ref: '#/components/schemas/AuthenticationErrorEnvelope'
      description: 'Authentication failed: missing credentials, invalid JWT, or expired access token.


        **Response body variants:** Some routes return JSON with a string `error` field (and optionally `codes` / `metadata`). Others return JSON where `error` is a structured object (`type`, `code`, `message`, and optionally `details`, `request_id`). The response may have **no body** even though the status is 401—clients should treat 401 as unauthenticated and refresh or re-authenticate regardless of body shape.'
    InternalServerError:
      content:
        application/json:
          examples:
            flat_string:
              summary: Flat error string
              value:
                error: string
            nested_error_object:
              summary: Nested error (shared HTTP error format)
              value:
                error:
                  code: INTERNAL_ERROR
                  message: string
                  type: INTERNAL
          schema:
            description: 5xx responses may use a flat or nested error shape.
            oneOf:
            - $ref: '#/components/schemas/ErrorResponse'
            - $ref: '#/components/schemas/AuthenticationErrorEnvelope'
      description: 'Unexpected server error or upstream failure. **Retry with exponential backoff**; do not assume a specific JSON body shape.


        **Response body variants:** Flat `ErrorResponse`, nested `error` object, or occasionally a minimal message.'
  securitySchemes:
    OAuth2:
      description: 'OAuth2 Bearer token: obtain an access token from the token endpoint and send it in the Authorization header.'
      flows:
        authorizationCode:
          authorizationUrl: https://app.aries.com/oauth2/authorize
          refreshUrl: https://api.aries.com/v1/oauth2/token
          scopes:
            account:information: View account balances, positions, and transaction history
            analytics:information: View analytics, ratings, and market insights
            calendar:information: Access earnings, economic, and market schedule data
            market:information: Access live and historical market data
            market:supplemental: News, company profiles, financials, filings, ETF data, technical analysis
            options:information: Access options chains and expiration data
            order:execution: Place, modify, and cancel orders
            order:information: View order history and status
            position:information: View current positions and holdings
            user:information: View user profile and personal details
            user:management: Manage user-scoped resources and saved configuration (internal).
            watchlist:information: View your watchlists and their symbols.
            watchlist:management: Create, update, replace, and delete your watchlists.
          tokenUrl: https://api.aries.com/v1/oauth2/token
        clientCredentials:
          refreshUrl: https://api.aries.com/v1/oauth2/token
          scopes:
            account:information: View account balances, positions, and transaction history
            analytics:information: View analytics, ratings, and market insights
            calendar:information: Access earnings, economic, and market schedule data
            market:information: Access live and historical market data
            market:supplemental: News, company profiles, financials, filings, ETF data, technical analysis
            options:information: Access options chains and expiration data
            order:execution: Place, modify, and cancel orders
            order:information: View order history and status
            position:information: View current positions and holdings
            user:information: View user profile and personal details
            user:management: Manage user-scoped resources and saved configuration (internal).
            watchlist:information: View your watchlists and their symbols.
            watchlist:management: Create, update, replace, and delete your watchlists.
          tokenUrl: https://api.aries.com/v1/oauth2/token
      type: oauth2