> ## Documentation Index
> Fetch the complete documentation index at: https://sure-917046f5-mintlify-docs-update-1787365312803.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create trade



## OpenAPI

````yaml /openapi.yaml post /api/v1/trades
openapi: 3.0.3
info:
  title: Sure API
  version: v1
  description: OpenAPI documentation generated from executable request specs.
servers:
  - url: https://app.sure.am
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/trades:
    post:
      tags:
        - Trades
      summary: Create trade
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                trade:
                  type: object
                  properties:
                    account_id:
                      type: string
                      format: uuid
                      description: Account ID (required)
                    date:
                      type: string
                      format: date
                      description: Trade date (required)
                    qty:
                      type: number
                      description: Quantity (required for buy/sell)
                    price:
                      type: number
                      description: Price (required for buy/sell)
                    amount:
                      type: number
                      description: >-
                        Amount (required for dividend, deposit, withdrawal,
                        interest)
                    type:
                      type: string
                      enum:
                        - buy
                        - sell
                        - dividend
                        - deposit
                        - withdrawal
                        - interest
                      description: Trade type (required)
                    security_id:
                      type: string
                      format: uuid
                      description: >-
                        Security ID (one of security_id, ticker, manual_ticker
                        required)
                    ticker:
                      type: string
                      description: Ticker symbol
                    manual_ticker:
                      type: string
                      description: Manual ticker for offline securities
                    currency:
                      type: string
                      description: Currency (defaults to account currency)
                    investment_activity_label:
                      type: string
                      description: Activity label (e.g. Buy, Sell)
                    category_id:
                      type: string
                      format: uuid
                      description: Category ID
                    transfer_account_id:
                      type: string
                      format: uuid
                      description: Destination/source account ID for linked transfers
                  required:
                    - account_id
                    - date
                    - type
              required:
                - trade
        required: true
      responses:
        '201':
          description: trade created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionResponse'
        '401':
          description: unauthorized - missing api key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: forbidden - api key missing read_write scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: account not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    TransactionResponse:
      type: object
      required:
        - id
        - date
        - amount
        - currency
        - name
        - entryable_type
        - account
      properties:
        id:
          type: string
          format: uuid
        date:
          type: string
          format: date
        amount:
          type: string
        currency:
          type: string
        name:
          type: string
        entryable_type:
          type: string
        account:
          type: object
          required:
            - id
            - name
            - account_type
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
            account_type:
              type: string
              nullable: true
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        message:
          type: string
          nullable: true
        details:
          oneOf:
            - type: array
              items:
                type: string
            - type: object
          nullable: true
        errors:
          type: array
          items:
            type: string
          nullable: true
          description: >-
            Validation error messages (alternative to details used by trades,
            valuations, etc.)
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header
      description: API key for authentication. Generate one from your account settings.

````