Airstack Casts API

The Casts API from Airstack — 4 operation(s) for casts.

OpenAPI Specification

airstack-casts-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Farcaster Hub REST Casts API
  version: '1.0'
  description: "Perform basic queries of Farcaster state via the REST API of a Farcaster hub. See the [Farcaster docs](https://www.thehubble.xyz/docs/httpapi/httpapi.html) for more details. Some client libraries:\n  - [TypeScript](https://www.npmjs.com/package/@standard-crypto/farcaster-js-hub-rest)\n"
servers:
- url: https://hubs.airstack.xyz
security:
- ApiKeyAuth: []
tags:
- name: Casts
paths:
  /v1/castById:
    get:
      security:
      - ApiKeyAuth: []
      tags:
      - Casts
      summary: Get a cast by its FID and Hash.
      operationId: GetCastById
      parameters:
      - name: fid
        in: query
        description: The FID of the cast's creator
        required: true
        schema:
          type: integer
        example: 6833
      - name: hash
        in: query
        description: The cast's hash
        required: true
        schema:
          pattern: ^0x[0-9a-fA-F]{40}$
          type: string
        example: '0xa48dd46161d8e57725f5e26e34ec19c13ff7f3b9'
      responses:
        '200':
          description: The requested Cast.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CastAdd'
        default:
          $ref: '#/components/responses/ErrorResponse'
  /v1/castsByFid:
    get:
      security:
      - ApiKeyAuth: []
      tags:
      - Casts
      summary: Fetch all casts authored by an FID.
      operationId: ListCastsByFid
      parameters:
      - name: fid
        in: query
        description: The FID of the casts' creator
        required: true
        schema:
          type: integer
        example: 6833
      - $ref: '#/components/parameters/pageSize'
      - $ref: '#/components/parameters/paginationReverse'
      - $ref: '#/components/parameters/pageToken'
      responses:
        '200':
          description: The requested Casts.
          content:
            application/json:
              schema:
                required:
                - messages
                - nextPageToken
                type: object
                properties:
                  messages:
                    type: array
                    items:
                      $ref: '#/components/schemas/CastAdd'
                  nextPageToken:
                    pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$
                    type: string
                    format: byte
        default:
          $ref: '#/components/responses/ErrorResponse'
  /v1/castsByMention:
    get:
      security:
      - ApiKeyAuth: []
      tags:
      - Casts
      summary: Fetch all casts that mention an FID
      operationId: ListCastsByMention
      parameters:
      - name: fid
        in: query
        description: The FID that is mentioned in a cast
        required: true
        schema:
          type: integer
        example: 6833
      - $ref: '#/components/parameters/pageSize'
      - $ref: '#/components/parameters/paginationReverse'
      - $ref: '#/components/parameters/pageToken'
      responses:
        '200':
          description: The requested Casts.
          content:
            application/json:
              schema:
                required:
                - messages
                - nextPageToken
                type: object
                properties:
                  messages:
                    type: array
                    items:
                      $ref: '#/components/schemas/CastAdd'
                  nextPageToken:
                    pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$
                    type: string
                    format: byte
        default:
          $ref: '#/components/responses/ErrorResponse'
  /v1/castsByParent:
    get:
      security:
      - ApiKeyAuth: []
      tags:
      - Casts
      summary: Fetch all casts by parent cast's FID and Hash OR by the parent's URL
      operationId: ListCastsByParent
      parameters:
      - name: fid
        in: query
        description: The FID of the parent cast
        schema:
          type: integer
        example: 226
      - name: hash
        in: query
        description: The parent cast's hash
        schema:
          type: string
        example: '0xa48dd46161d8e57725f5e26e34ec19c13ff7f3b9'
      - name: url
        in: query
        schema:
          type: string
        example: chain://eip155:1/erc721:0x39d89b649ffa044383333d297e325d42d31329b2
      - $ref: '#/components/parameters/pageSize'
      - $ref: '#/components/parameters/paginationReverse'
      - $ref: '#/components/parameters/pageToken'
      responses:
        '200':
          description: The requested Casts.
          content:
            application/json:
              schema:
                required:
                - messages
                - nextPageToken
                type: object
                properties:
                  messages:
                    type: array
                    items:
                      $ref: '#/components/schemas/CastAdd'
                  nextPageToken:
                    pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$
                    type: string
                    format: byte
        default:
          $ref: '#/components/responses/ErrorResponse'
components:
  schemas:
    CastAdd:
      allOf:
      - $ref: '#/components/schemas/MessageCommon'
      - type: object
        properties:
          data:
            allOf:
            - $ref: '#/components/schemas/MessageDataCastAdd'
            - type: object
              properties:
                type:
                  $ref: '#/components/schemas/MessageType'
              required:
              - type
        required:
        - data
    CastEmbed:
      type: object
      properties:
        castId:
          $ref: '#/components/schemas/CastId'
      required:
      - castId
    Embed:
      oneOf:
      - $ref: '#/components/schemas/CastEmbed'
      - $ref: '#/components/schemas/UrlEmbed'
    SignatureScheme:
      type: string
      description: "Type of signature scheme used to sign the Message hash\n- SIGNATURE_SCHEME_ED25519: Ed25519 signature (default)\n - SIGNATURE_SCHEME_EIP712: ECDSA signature using EIP-712 scheme"
      default: SIGNATURE_SCHEME_ED25519
      enum:
      - SIGNATURE_SCHEME_ED25519
      - SIGNATURE_SCHEME_EIP712
    FarcasterNetwork:
      type: string
      description: "Farcaster network the message is intended for.\n- FARCASTER_NETWORK_MAINNET: Public primary network\n - FARCASTER_NETWORK_TESTNET: Public test network\n - FARCASTER_NETWORK_DEVNET: Private test network"
      default: FARCASTER_NETWORK_MAINNET
      enum:
      - FARCASTER_NETWORK_MAINNET
      - FARCASTER_NETWORK_TESTNET
      - FARCASTER_NETWORK_DEVNET
    MessageCommon:
      type: object
      properties:
        hash:
          title: Hash digest of data
          pattern: ^0x[0-9a-fA-F]{40}$
          type: string
          example: '0xd2b1ddc6c88e865a33cb1a565e0058d757042974'
        hashScheme:
          $ref: '#/components/schemas/HashScheme'
        signature:
          title: Signature of the hash digest
          pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$
          type: string
          format: byte
        signatureScheme:
          $ref: '#/components/schemas/SignatureScheme'
        signer:
          title: Public key or address of the key pair that produced the signature
          pattern: ^0x[0-9a-fA-F]+$
          type: string
      required:
      - hash
      - hashScheme
      - signature
      - signatureScheme
      - signer
    UrlEmbed:
      type: object
      properties:
        url:
          type: string
          format: uri
      required:
      - url
    MessageType:
      type: string
      description: "Type of the MessageBody.\n - MESSAGE_TYPE_CAST_ADD: Add a new Cast\n - MESSAGE_TYPE_CAST_REMOVE: Remove an existing Cast\n - MESSAGE_TYPE_REACTION_ADD: Add a Reaction to a Cast\n - MESSAGE_TYPE_REACTION_REMOVE: Remove a Reaction from a Cast\n - MESSAGE_TYPE_LINK_ADD: Add a new Link\n - MESSAGE_TYPE_LINK_REMOVE: Remove an existing Link\n - MESSAGE_TYPE_VERIFICATION_ADD_ETH_ADDRESS: Add a Verification of an Ethereum Address\n - MESSAGE_TYPE_VERIFICATION_REMOVE: Remove a Verification\n - MESSAGE_TYPE_USER_DATA_ADD: Add metadata about a user\n - MESSAGE_TYPE_USERNAME_PROOF: Add or replace a username proof\n - MESSAGE_TYPE_FRAME_ACTION: A Farcaster Frame action"
      default: MESSAGE_TYPE_CAST_ADD
      enum:
      - MESSAGE_TYPE_CAST_ADD
      - MESSAGE_TYPE_CAST_REMOVE
      - MESSAGE_TYPE_REACTION_ADD
      - MESSAGE_TYPE_REACTION_REMOVE
      - MESSAGE_TYPE_LINK_ADD
      - MESSAGE_TYPE_LINK_REMOVE
      - MESSAGE_TYPE_VERIFICATION_ADD_ETH_ADDRESS
      - MESSAGE_TYPE_VERIFICATION_REMOVE
      - MESSAGE_TYPE_USER_DATA_ADD
      - MESSAGE_TYPE_USERNAME_PROOF
      - MESSAGE_TYPE_FRAME_ACTION
    HashScheme:
      type: string
      description: 'Type of hashing scheme used to produce a digest of MessageData. - HASH_SCHEME_BLAKE3: Default scheme for hashing MessageData

        '
      default: HASH_SCHEME_BLAKE3
      enum:
      - HASH_SCHEME_BLAKE3
    CastHash:
      pattern: ^0x[0-9a-fA-F]{40}$
      type: string
    ErrorResponse:
      required:
      - code
      - details
      - errCode
      - metadata
      - name
      - presentable
      type: object
      properties:
        errCode:
          type: string
        presentable:
          type: boolean
        name:
          type: string
        code:
          type: integer
        details:
          type: string
        metadata:
          required:
          - errcode
          type: object
          properties:
            errcode:
              type: array
              items:
                type: string
    MessageDataCastAdd:
      allOf:
      - $ref: '#/components/schemas/MessageDataCommon'
      - type: object
        required:
        - castAddBody
        properties:
          castAddBody:
            $ref: '#/components/schemas/CastAddBody'
    MessageDataCommon:
      required:
      - fid
      - network
      - timestamp
      type: object
      properties:
        fid:
          title: Farcaster ID of the user producing the message
          type: integer
          format: uint64
          example: 2
        timestamp:
          title: Farcaster epoch timestamp in seconds
          type: integer
          format: int64
          example: 48994466
        network:
          $ref: '#/components/schemas/FarcasterNetwork'
    CastId:
      description: Identifier used to look up a Cast
      required:
      - fid
      - hash
      type: object
      properties:
        fid:
          title: Fid of the user who created the cast
          type: integer
          format: uint64
        hash:
          $ref: '#/components/schemas/CastHash'
    CastAddBody:
      description: Adds a new Cast
      type: object
      properties:
        embedsDeprecated:
          title: URLs to be embedded in the cast
          type: array
          items:
            type: string
        mentions:
          title: Fids mentioned in the cast
          type: array
          items:
            type: integer
            format: uint64
            example: 2
        parentCastId:
          $ref: '#/components/schemas/CastId'
        parentUrl:
          title: Parent URL
          type: string
          example: chain://eip155:1/erc721:0x39d89b649ffa044383333d297e325d42d31329b2
        text:
          title: Text of the cast
          type: string
        mentionsPositions:
          title: Positions of the mentions in the text
          type: array
          items:
            type: integer
            format: int64
        embeds:
          title: URLs or cast ids to be embedded in the cast
          type: array
          items:
            $ref: '#/components/schemas/Embed'
      required:
      - embedsDeprecated
      - mentions
      - text
      - mentionsPositions
      - embeds
  parameters:
    pageToken:
      name: pageToken
      in: query
      description: The page token returned by the previous query, to fetch the next page. If this parameter is empty, fetch the first page
      schema:
        type: string
    pageSize:
      name: pageSize
      in: query
      description: Maximum number of messages to return in a single response
      schema:
        type: integer
    paginationReverse:
      name: reverse
      in: query
      description: Reverse the sort order, returning latest messages first
      schema:
        type: boolean
  responses:
    ErrorResponse:
      description: An unexpected error response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-airstack-hubs