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

# Update trade



## OpenAPI

````yaml /openapi.yaml patch /api/v1/trades/{id}
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/{id}:
    parameters:
      - name: id
        in: path
        required: true
        description: Trade ID
        schema:
          type: string
    patch:
      tags:
        - Trades
      summary: Update trade
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                trade:
                  type: object
                  properties:
                    date:
                      type: string
                      format: date
                    qty:
                      type: number
                    price:
                      type: number
                    type:
                      type: string
                      enum:
                        - buy
                        - sell
                        - dividend
                        - deposit
                        - withdrawal
                        - interest
                    nature:
                      type: string
                      enum:
                        - inflow
                        - outflow
                    name:
                      type: string
                    notes:
                      type: string
                    currency:
                      type: string
                    investment_activity_label:
                      type: string
                    category_id:
                      type: string
                      format: uuid
        required: true
      responses:
        '200':
          description: trade updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Trade'
        '401':
          description: unauthorized
          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: trade not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    Trade:
      type: object
      required:
        - id
        - date
        - amount
        - currency
        - name
        - qty
        - price
        - account
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        date:
          type: string
          format: date
        amount:
          type: string
        currency:
          type: string
        name:
          type: string
        notes:
          type: string
          nullable: true
        qty:
          type: string
        price:
          type: string
        investment_activity_label:
          type: string
          nullable: true
        account:
          $ref: '#/components/schemas/Account'
        security:
          type: object
          nullable: true
          properties:
            id:
              type: string
              format: uuid
            ticker:
              type: string
            name:
              type: string
              nullable: true
        category:
          type: object
          nullable: true
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    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.)
    Account:
      type: object
      required:
        - id
        - name
        - account_type
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        account_type:
          type: string
          nullable: true
        status:
          type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header
      description: API key for authentication. Generate one from your account settings.

````