CoinGate Conversions API

Convert between currencies in ledger accounts

OpenAPI Specification

coingate-conversions-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: CoinGate Payment Gateway Conversions API
  description: REST API for accepting cryptocurrency payments, managing orders, processing refunds, handling payouts, performing currency conversions, and accessing merchant ledger and billing data. Supports both production and sandbox environments.
  version: '2'
  contact:
    name: CoinGate Support
    url: https://coingate.com/contact
    email: support@coingate.com
  termsOfService: https://coingate.com/terms
  x-logo:
    url: https://coingate.com/images/coingate-logo.png
servers:
- url: https://api.coingate.com/api/v2
  description: Production
- url: https://api-sandbox.coingate.com/api/v2
  description: Sandbox
security:
- bearerAuth: []
tags:
- name: Conversions
  description: Convert between currencies in ledger accounts
paths:
  /ledger/conversions:
    post:
      summary: Create Conversion
      description: Create a currency conversion between ledger accounts.
      operationId: create-conversion
      tags:
      - Conversions
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
              - ledger_account_id
              - quote_currency_id
              - base_amount
              properties:
                ledger_account_id:
                  type: string
                  description: ID of the ledger account to convert from
                quote_currency_id:
                  type: integer
                  format: int32
                  description: ID of the target currency to convert to
                base_amount:
                  type: string
                  description: Amount to convert in the source ledger account currency
      responses:
        '200':
          description: Conversion created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  status:
                    type: string
                  base_amount:
                    type: string
                  quote_amount:
                    type: string
                  base_ledger_account:
                    $ref: '#/components/schemas/LedgerAccount'
                  quote_ledger_account:
                    $ref: '#/components/schemas/LedgerAccount'
                  fees:
                    type: object
                  actions_required:
                    type: object
                  created_at:
                    type: string
                    format: date-time
                  expires_at:
                    type: string
                    format: date-time
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    get:
      summary: List Conversions
      description: Retrieve a paginated list of currency conversions.
      operationId: list-conversions
      tags:
      - Conversions
      parameters:
      - name: per_page
        in: query
        schema:
          type: integer
          format: int32
          default: 100
      - name: page
        in: query
        schema:
          type: integer
          format: int32
          default: 1
      responses:
        '200':
          description: List of conversions
          content:
            application/json:
              schema:
                type: object
                properties:
                  current_page:
                    type: integer
                  per_page:
                    type: integer
                  total_records:
                    type: integer
                  total_pages:
                    type: integer
                  exchange_transactions:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        status:
                          type: string
                        base_amount:
                          type: string
                        quote_amount:
                          type: string
                        fees:
                          type: object
                        created_at:
                          type: string
                          format: date-time
                        expires_at:
                          type: string
                          format: date-time
components:
  schemas:
    LedgerAccount:
      type: object
      properties:
        id:
          type: string
        balance:
          type: string
        status:
          type: string
          enum:
          - active
          - inactive
        currency:
          $ref: '#/components/schemas/Currency'
    Error:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message
        reason:
          type: string
          description: Machine-readable error reason code
        errors:
          type: array
          items:
            type: string
          description: List of validation errors
    Currency:
      type: object
      properties:
        id:
          type: integer
        title:
          type: string
        kind:
          type: string
          enum:
          - crypto
          - fiat
        symbol:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API Token authentication. Obtain your API token from the CoinGate merchant dashboard.
externalDocs:
  description: CoinGate Developer Documentation
  url: https://developer.coingate.com/docs/api-overview