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

# Update a transaction



## OpenAPI

````yaml /openapi.yaml patch /api/v1/transactions/{id}
openapi: 3.0.3
info:
  title: Sure API
  version: v1
  description: OpenAPI documentation for the Sure API.
servers:
  - url: https://app.sure.am
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/transactions/{id}:
    parameters:
      - name: id
        in: path
        required: true
        description: Transaction ID
        schema:
          type: string
    patch:
      tags:
        - Transactions
      summary: Update a transaction
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                transaction:
                  type: object
                  properties:
                    date:
                      type: string
                      format: date
                    amount:
                      type: number
                    name:
                      type: string
                    description:
                      type: string
                      description: Alternative to name field
                    notes:
                      type: string
                    currency:
                      type: string
                      description: Currency code
                    category_id:
                      type: string
                      format: uuid
                    merchant_id:
                      type: string
                      format: uuid
                    nature:
                      type: string
                      enum:
                        - income
                        - expense
                        - inflow
                        - outflow
                    tag_ids:
                      type: array
                      items:
                        type: string
                        format: uuid
        required: true
      responses:
        '200':
          description: transaction updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transaction'
        '404':
          description: transaction not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    Transaction:
      type: object
      required:
        - id
        - date
        - amount
        - amount_cents
        - signed_amount_cents
        - currency
        - name
        - classification
        - account
        - tags
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        date:
          type: string
          format: date
        amount:
          type: string
          description: Localized, formatted amount string (e.g. "$50.00")
        amount_cents:
          type: integer
          minimum: 0
          description: >-
            Absolute amount in minor currency units (e.g. 5000 for $50.00 USD).
            Uses the currency's minor-unit conversion factor.
        signed_amount_cents:
          type: integer
          description: >-
            Signed amount in minor currency units. Positive for income, negative
            for expenses.
        currency:
          type: string
        name:
          type: string
        notes:
          type: string
          nullable: true
        classification:
          type: string
          enum:
            - income
            - expense
        account:
          $ref: '#/components/schemas/Account'
        category:
          $ref: '#/components/schemas/Category'
          nullable: true
        merchant:
          $ref: '#/components/schemas/Merchant'
          nullable: true
        tags:
          type: array
          items:
            $ref: '#/components/schemas/Tag'
        transfer:
          $ref: '#/components/schemas/Transfer'
          nullable: true
        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
    Account:
      type: object
      required:
        - id
        - name
        - account_type
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        account_type:
          type: string
    Category:
      type: object
      required:
        - id
        - name
        - classification
        - color
        - icon
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        classification:
          type: string
        color:
          type: string
        icon:
          type: string
    Merchant:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
    Tag:
      type: object
      required:
        - id
        - name
        - color
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        color:
          type: string
    Transfer:
      type: object
      required:
        - id
        - amount
        - currency
      properties:
        id:
          type: string
          format: uuid
        amount:
          type: string
        currency:
          type: string
        other_account:
          $ref: '#/components/schemas/Account'
          nullable: true
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header
      description: API key for authentication. Generate one from your account settings.

````