> ## Documentation Index
> Fetch the complete documentation index at: https://finance.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Create OAuth2 Client

> Creates a new OAuth2 API client for the authenticated user. This endpoint allows authenticated users to create OAuth2 clients for their applications. The client will be associated with the authenticated user and can be used to implement OAuth2 authorization flows. The created client will include a client_id and client_secret that should be securely stored by the user. The client_secret cannot be retrieved again after creation. The client supports custom scopes to define permissions, multiple redirect URIs for OAuth2 authorization callbacks, and optional domain restrictions for enhanced security.



## OpenAPI

````yaml https://spec.speakeasy.com/aries/aries/aries-trading-platform-api-with-code-samples post /v1/users/api/clients
openapi: 3.0.3
info:
  title: Aries Trading Platform API
  description: >-
    Complete API documentation for the Aries trading platform including user
    management, authentication, account management, order management, market
    data, and analytics
  contact:
    name: Aries Financial
    email: dev@aries.com
  version: 1.0.0
servers:
  - url: https://api.tradearies.dev
    description: Production server
security: []
tags:
  - name: Accounts
    description: Account management endpoints for positions, orders, and balances
  - name: Analytics
    description: >-
      Analytics endpoints for market data analysis including top gainers,
      losers, volume leaders, sector analysis, analyst ratings, market breadth,
      and net inflow
  - name: Authentication
    description: User authentication endpoints
  - name: Calendars
    description: Calendar endpoints for economic events and historical data
  - name: Market Data
    description: >-
      Market data endpoints for symbol search, real-time data access, and equity
      details
  - name: Orders
    description: >-
      Order management endpoints for placing, updating, canceling, and
      previewing orders
  - name: Users
    description: User management endpoints
  - name: Health
    description: Service health endpoints
paths:
  /v1/users/api/clients:
    post:
      tags:
        - Clients
      summary: Create OAuth2 Client
      description: >-
        Creates a new OAuth2 API client for the authenticated user. This
        endpoint allows authenticated users to create OAuth2 clients for their
        applications. The client will be associated with the authenticated user
        and can be used to implement OAuth2 authorization flows. The created
        client will include a client_id and client_secret that should be
        securely stored by the user. The client_secret cannot be retrieved again
        after creation. The client supports custom scopes to define permissions,
        multiple redirect URIs for OAuth2 authorization callbacks, and optional
        domain restrictions for enhanced security.
      operationId: createApiClient
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Client name
                scopes:
                  type: array
                  items:
                    type: string
                  description: List of allowed scopes
                redirect_uris:
                  type: array
                  items:
                    type: string
                  description: List of allowed redirect URIs
                domains:
                  type: array
                  items:
                    type: string
                  description: List of allowed domains (optional)
              required:
                - name
                - scopes
                - redirect_uris
        required: true
      responses:
        '200':
          description: Client created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  client_id:
                    type: string
                    description: OAuth2 client ID
                  client_secret:
                    type: string
                    description: OAuth2 client secret (shown only once)
                  name:
                    type: string
                    description: Client name
                  scopes:
                    type: array
                    items:
                      type: string
                    description: List of allowed scopes
                  redirect_uris:
                    type: array
                    items:
                      type: string
                    description: List of allowed redirect URIs
                  domains:
                    type: array
                    items:
                      type: string
                    description: List of allowed domains
                  created_at:
                    type: string
                    format: date-time
                    description: Client creation timestamp
                  updated_at:
                    type: string
                    format: date-time
                    description: Client last update timestamp
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized - invalid authentication
        '500':
          description: Internal server error
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: java
          label: Java (SDK)
          source: >-
            package hello.world;


            import java.lang.Exception;

            import java.util.List;

            import org.openapis.openapi.AriesJava;

            import org.openapis.openapi.models.errors.ErrorResponse;

            import
            org.openapis.openapi.models.operations.CreateApiClientRequest;

            import
            org.openapis.openapi.models.operations.CreateApiClientResponse;


            public class Application {

                public static void main(String[] args) throws ErrorResponse, Exception {

                    AriesJava sdk = AriesJava.builder()
                            .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
                        .build();

                    CreateApiClientRequest req = CreateApiClientRequest.builder()
                            .name("<value>")
                            .scopes(List.of(
                                "<value 1>"))
                            .redirectUris(List.of(
                                "<value 1>",
                                "<value 2>"))
                            .build();

                    CreateApiClientResponse res = sdk.clients().create()
                            .request(req)
                            .call();

                    if (res.object().isPresent()) {
                        // handle response
                    }
                }
            }
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
        codes:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                description: Error code
              description:
                type: string
                description: Error description
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````