Stellar Operations API

Operations are objects that represent a desired change to the ledger: payments, offers to exchange currency, changes made to account options, etc. Operations are submitted to the Stellar network grouped in a Transaction.

OpenAPI Specification

stellar-operations-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  version: 3.0.0
  title: Platform Server Accounts Operations API
  description: 'The platform server is an internal component. It should be hosted in a private network and should not be accessible from the Internet. This server enables the business to fetch and update the state of transactions using its API.

    '
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://platform-server.exampleanchor.com
tags:
- name: Operations
  description: 'Operations are objects that represent a desired change to the ledger: payments, offers to exchange currency, changes made to account options, etc. Operations are submitted to the Stellar network grouped in a Transaction.'
paths:
  /operations/{id}:
    get:
      tags:
      - Operations
      summary: Retrieve an Operation
      description: The single operation endpoint provides information about a specific operation.
      operationId: RetrieveAnOperation
      parameters:
      - $ref: '#/components/parameters/IdParam'
      - $ref: '#/components/parameters/JoinParam'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Links'
                - $ref: '#/components/schemas/Operation'
              examples:
                RetrieveAnOperation:
                  $ref: '#/components/examples/RetrieveAnOperation'
  /operations/{id}/effects:
    get:
      tags:
      - Operations
      summary: Retrieve an Operation's Effects
      description: This endpoint returns the effects of a specific operation.
      operationId: RetrieveAnOperationsEffects
      parameters:
      - $ref: '#/components/parameters/IdParam'
      - $ref: '#/components/parameters/CursorParam'
      - $ref: '#/components/parameters/OrderParam'
      - $ref: '#/components/parameters/LimitParam'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Links'
                - $ref: '#/components/schemas/Effect'
              examples:
                RetrieveAnOperationsEffects:
                  $ref: '#/components/examples/RetrieveAnOperationsEffects'
  /operations:
    get:
      tags:
      - Operations
      summary: List All Operations
      description: This endpoint lists all Successful operations and can be used in streaming mode. Streaming mode allows you to listen for new operations as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known operation unless a cursor is set, in which case it will start from that cursor. By setting the cursor value to now, you can stream operations created since your request time.
      operationId: ListAllOperations
      parameters:
      - $ref: '#/components/parameters/CursorParam'
      - $ref: '#/components/parameters/OrderParam'
      - $ref: '#/components/parameters/LimitParam'
      - $ref: '#/components/parameters/IncludeFailedParam'
      - $ref: '#/components/parameters/JoinParam'
      x-supports-streaming: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Links'
                - $ref: '#/components/schemas/Operation'
              examples:
                ListAllOperations:
                  $ref: '#/components/examples/ListAllOperations'
components:
  examples:
    RetrieveAnOperationsEffects:
      value:
        _links:
          self:
            href: https://horizon-testnet.stellar.org/operations/121693057904021505/effects?cursor=&limit=10&order=asc
          next:
            href: https://horizon-testnet.stellar.org/operations/121693057904021505/effects?cursor=121693057904021505-2&limit=10&order=asc
          prev:
            href: https://horizon-testnet.stellar.org/operations/121693057904021505/effects?cursor=121693057904021505-1&limit=10&order=desc
        _embedded:
          records:
          - _links:
              operation:
                href: https://horizon-testnet.stellar.org/operations/121693057904021505
              succeeds:
                href: https://horizon-testnet.stellar.org/effects?order=desc&cursor=121693057904021505-1
              precedes:
                href: https://horizon-testnet.stellar.org/effects?order=asc&cursor=121693057904021505-1
            id: 0121693057904021505-0000000001
            paging_token: 121693057904021505-1
            account: GALSPNVKGNRJ3VIOQ26QKPZBDCTVJK7XPLSPF3UVZV3JJXCKVCHNSPCK
            type: account_credited
            type_i: 2
            created_at: '2020-02-21T20:27:30Z'
            asset_type: credit_alphanum4
            asset_code: NODL
            asset_issuer: GB2Y3AWXVROM2BHFQKQPTWKIOI3TZEBBD3LTKTVQTKEPXGOBE742NODL
            amount: '0.0000027'
          - _links:
              operation:
                href: https://horizon-testnet.stellar.org/operations/121693057904021505
              succeeds:
                href: https://horizon-testnet.stellar.org/effects?order=desc&cursor=121693057904021505-2
              precedes:
                href: https://horizon-testnet.stellar.org/effects?order=asc&cursor=121693057904021505-2
            id: 0121693057904021505-0000000002
            paging_token: 121693057904021505-2
            account: GDQWI6FKB72DPOJE4CGYCFQZKRPQQIOYXRMZ5KEVGXMG6UUTGJMBCASH
            type: account_debited
            type_i: 3
            created_at: '2020-02-21T20:27:30Z'
            asset_type: credit_alphanum4
            asset_code: NODL
            asset_issuer: GB2Y3AWXVROM2BHFQKQPTWKIOI3TZEBBD3LTKTVQTKEPXGOBE742NODL
            amount: '0.0000027'
    RetrieveAnOperation:
      value:
        _links:
          self:
            href: https://horizon-testnet.stellar.org/operations/121692259040116737
          transaction:
            href: https://horizon-testnet.stellar.org/transactions/f92a9648c1084d1de0fd786faac5d5e1637d4127c60841d2366c70d2e7f77b85
          effects:
            href: https://horizon-testnet.stellar.org/operations/121692259040116737/effects
          succeeds:
            href: https://horizon-testnet.stellar.org/effects?order=desc&cursor=121692259040116737
          precedes:
            href: https://horizon-testnet.stellar.org/effects?order=asc&cursor=121692259040116737
        id: '121692259040116737'
        paging_token: '121692259040116737'
        transaction_successful: true
        source_account: GBDVKE33GVVMBXX73OHIBRP6RAHKHHW2P4PQVV6UNOKQCOXU7GNUM4QI
        type: manage_offer
        type_i: 3
        created_at: '2020-02-21T20:10:21Z'
        transaction_hash: f92a9648c1084d1de0fd786faac5d5e1637d4127c60841d2366c70d2e7f77b85
        amount: '10000.0000000'
        price: '0.0704336'
        price_r:
          n: 44021
          d: 625000
        buying_asset_type: credit_alphanum4
        buying_asset_code: USD
        buying_asset_issuer: GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX
        selling_asset_type: native
        offer_id: 161536436
    ListAllOperations:
      value:
        _links:
          self:
            href: https://horizon-testnet.stellar.org/operations?cursor=&limit=3&order=asc
          next:
            href: https://horizon-testnet.stellar.org/operations?cursor=12884905987&limit=3&order=asc
          prev:
            href: https://horizon-testnet.stellar.org/operations?cursor=12884905985&limit=3&order=desc
        _embedded:
          records:
          - _links:
              self:
                href: https://horizon-testnet.stellar.org/operations/12884905985
              transaction:
                href: https://horizon-testnet.stellar.org/transactions/3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889
              effects:
                href: https://horizon-testnet.stellar.org/operations/12884905985/effects
              succeeds:
                href: https://horizon-testnet.stellar.org/effects?order=desc&cursor=12884905985
              precedes:
                href: https://horizon-testnet.stellar.org/effects?order=asc&cursor=12884905985
            id: '12884905985'
            paging_token: '12884905985'
            transaction_successful: true
            source_account: GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7
            type: create_account
            type_i: 0
            created_at: '2015-09-30T17:15:54Z'
            transaction_hash: 3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889
            starting_balance: '20.0000000'
            funder: GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7
            account: GALPCCZN4YXA3YMJHKL6CVIECKPLJJCTVMSNYWBTKJW4K5HQLYLDMZTB
          - _links:
              self:
                href: https://horizon-testnet.stellar.org/operations/12884905986
              transaction:
                href: https://horizon-testnet.stellar.org/transactions/3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889
              effects:
                href: https://horizon-testnet.stellar.org/operations/12884905986/effects
              succeeds:
                href: https://horizon-testnet.stellar.org/effects?order=desc&cursor=12884905986
              precedes:
                href: https://horizon-testnet.stellar.org/effects?order=asc&cursor=12884905986
            id: '12884905986'
            paging_token: '12884905986'
            transaction_successful: true
            source_account: GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7
            type: payment
            type_i: 1
            created_at: '2015-09-30T17:15:54Z'
            transaction_hash: 3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889
            asset_type: native
            from: GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7
            to: GALPCCZN4YXA3YMJHKL6CVIECKPLJJCTVMSNYWBTKJW4K5HQLYLDMZTB
            amount: '99999999959.9999700'
          - _links:
              self:
                href: https://horizon-testnet.stellar.org/operations/12884905987
              transaction:
                href: https://horizon-testnet.stellar.org/transactions/3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889
              effects:
                href: https://horizon-testnet.stellar.org/operations/12884905987/effects
              succeeds:
                href: https://horizon-testnet.stellar.org/effects?order=desc&cursor=12884905987
              precedes:
                href: https://horizon-testnet.stellar.org/effects?order=asc&cursor=12884905987
            id: '12884905987'
            paging_token: '12884905987'
            transaction_successful: true
            source_account: GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7
            type: set_options
            type_i: 5
            created_at: '2015-09-30T17:15:54Z'
            transaction_hash: 3389e9f0f1a65f19736cacf544c2e825313e8447f569233bb8db39aa607c8889
            master_key_weight: 0
  schemas:
    id:
      type: string
    address:
      type: string
      pattern: G[A-Z0-9]{55}
    paging_token:
      type: string
    Effect:
      type: object
      properties:
        _embedded:
          type: object
          properties:
            records:
              type: array
              items:
                type: object
                properties:
                  _links:
                    type: object
                    properties:
                      operation:
                        $ref: '#/components/schemas/link'
                      succeeds:
                        $ref: '#/components/schemas/link'
                      precedes:
                        $ref: '#/components/schemas/link'
                  id:
                    $ref: '#/components/schemas/id'
                  paging_token:
                    $ref: '#/components/schemas/paging_token'
                  account:
                    $ref: '#/components/schemas/address'
                  type:
                    type: string
                    enum:
                    - Account Created
                    - Account Removed
                    - Account Credited
                    - Account Debited
                    - Account Thresholds Updated
                    - Account Home Domain Updated
                    - Account Flags Updated
                    - Account Inflation Destination Updated
                    - Signer Created
                    - Signer Removed
                    - Signer Updated
                    - Trustline Created
                    - Trustline Removed
                    - Trustline Updated
                    - Trustline Authorized
                    - Trustline Deauthorized
                    - Offer Created
                    - Offer Removed
                    - Offer Updated
                    - Trade
                    - Data Created
                    - Data Removed
                    - Data Updated
                    - Claimable Balance Created
                    - Claimable Balance Claimant Created
                    - Claimable Balance Claimed
                    - Account Sponsorship Created
                    - Account Sponsorship Updated
                    - Account Sponsorship Removed
                    - Trustline Sponsorship Created
                    - Trustline Sponsorship Updated
                    - Trustline Sponsorship Removed
                    - Account Data Sponsorship Created
                    - Account Data Sponsorship Updated
                    - Account Data Sponsorship Removed
                    - Claimable Balance Sponsorship Created
                    - Claimable Balance Sponsorship Updated
                    - Claimable Balance Sponsorship Removed
                    - Account Signer Sponsorship Created
                    - Account Signer Sponsorship Updated
                    - Account Signer Sponsorship Removed
                    - Liquidity Pool Created
                    - Liquidity Pool Removed
                    - Liquidity Pool Revoked
                    - Liquidity Pool Deposited
                    - Liquidity Pool Withdraw
                    - Liquidity Pool Trade
                    - Sequence Bumped
                  type_i:
                    type: number
                    example: 1
                  created_at:
                    type: string
          required:
          - id
          - paging_token
          - account
          - type
          - type_i
          - created_at
    link:
      type: object
      properties:
        href:
          type: string
          format: link
        templated:
          type: boolean
      required:
      - href
    Operation:
      type: object
      properties:
        _links:
          type: object
          properties:
            effects:
              $ref: '#/components/schemas/link'
            precedes:
              $ref: '#/components/schemas/link'
            self:
              $ref: '#/components/schemas/link'
            succeds:
              $ref: '#/components/schemas/link'
            transaction:
              $ref: '#/components/schemas/link'
        id:
          $ref: '#/components/schemas/id'
        paging_token:
          $ref: '#/components/schemas/paging_token'
        type_i:
          type: number
          example: 0
        type:
          type: string
          example: create_account
    Links:
      type: object
      properties:
        _links:
          type: object
          properties:
            self:
              $ref: '#/components/schemas/link'
            next:
              $ref: '#/components/schemas/link'
            prev:
              $ref: '#/components/schemas/link'
  parameters:
    OrderParam:
      name: order
      in: query
      required: false
      description: A designation of the order in which records should appear. Options include `asc` (ascending) or `desc` (descending). If this argument isn’t set, it defaults to `asc`.
      schema:
        type: string
        enum:
        - asc
        - desc
    CursorParam:
      name: cursor
      in: query
      required: false
      description: A number that points to a specific location in a collection of responses and is pulled from the paging_token value of a record.
      schema:
        type: integer
        example: 6606617478959105
    LimitParam:
      name: limit
      in: query
      required: false
      description: The maximum number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10.
      schema:
        type: integer
        example: 10
    JoinParam:
      name: join
      in: query
      required: false
      description: Set to transactions to include the transactions which created each of the operations in the response.
    IdParam:
      name: id
      in: path
      required: true
      description: The ID number for this operation.
      schema:
        type: string
        example: 121692259040116740
    IncludeFailedParam:
      name: include_failed
      in: query
      required: false
      description: Set to true to include failed operations in results. Options include true and false.
      schema:
        type: boolean
        enum:
        - true
        - false