IPFS Swarm API

The Swarm API from IPFS — 13 operation(s) for swarm.

OpenAPI Specification

ipfs-swarm-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: IPFS RPC Add Swarm API
  version: v0
  description: 'When a Kubo IPFS node is running as a daemon, it exposes an HTTP RPC API that allows you to control the node and run the same commands you can from the command line.


    In many cases, using this RPC API is preferable to embedding IPFS directly in your program — it allows you to maintain peer connections that are longer lived than your app and you can keep a single IPFS node running instead of several if your app can be launched multiple times. In fact, the `ipfs` CLI commands use this RPC API when operating in online mode.'
  x-providerName: IPFS
  x-logo:
    url: https://raw.githubusercontent.com/ipfs/ipfs-docs/55fe8bc6a53ba3b9023951fb4b432efbbc81fba5/docs/.vuepress/public/images/ipfs-logo.svg
servers:
- description: Local IPFS node
  url: http://localhost:5001
- description: Local IPFS node
  url: http://127.0.0.1:5001
- description: Infura hosted IPFS node
  url: https://ipfs.infura.io:5001
tags:
- name: Swarm
paths:
  /api/v0/swarm/addrs:
    post:
      operationId: swarm/addrs
      description: List known addresses. Useful for debugging.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-addrs
      parameters: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                Addrs:
                  <string>:
                  - <string>
      tags:
      - Swarm
  /api/v0/swarm/addrs/listen:
    post:
      operationId: swarm/addrs/listen
      description: List interface listening addresses.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-addrs-listen
      parameters: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                Strings:
                - <string>
      tags:
      - Swarm
  /api/v0/swarm/addrs/local:
    post:
      operationId: swarm/addrs/local
      description: List local addresses.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-addrs-local
      parameters:
      - name: id
        in: query
        description: Show peer ID in addresses.
        schema:
          type: boolean
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                Strings:
                - <string>
      tags:
      - Swarm
  /api/v0/swarm/connect:
    post:
      operationId: swarm/connect
      description: Open connection to a given address.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-connect
      parameters:
      - name: arg
        in: query
        description: Address of peer to connect to.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                Strings:
                - <string>
      tags:
      - Swarm
  /api/v0/swarm/disconnect:
    post:
      operationId: swarm/disconnect
      description: Close connection to a given address.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-disconnect
      parameters:
      - name: arg
        in: query
        description: Address of peer to disconnect from.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                Strings:
                - <string>
      tags:
      - Swarm
  /api/v0/swarm/filters:
    post:
      operationId: swarm/filters
      description: Manipulate address filters.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-filters
      parameters: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                Strings:
                - <string>
      tags:
      - Swarm
  /api/v0/swarm/filters/add:
    post:
      operationId: swarm/filters/add
      description: Add an address filter.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-filters-add
      parameters:
      - name: arg
        in: query
        description: Multiaddr to filter.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                Strings:
                - <string>
      tags:
      - Swarm
  /api/v0/swarm/filters/rm:
    post:
      operationId: swarm/filters/rm
      description: Remove an address filter.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-filters-rm
      parameters:
      - name: arg
        in: query
        description: Multiaddr filter to remove.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                Strings:
                - <string>
      tags:
      - Swarm
  /api/v0/swarm/peering/add:
    post:
      operationId: swarm/peering/add
      description: Add peers into the peering subsystem.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-peering-add
      parameters:
      - name: arg
        in: query
        description: address of peer to add into the peering subsystem
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                ID: <peer-id>
                Status: <string>
      tags:
      - Swarm
  /api/v0/swarm/peering/ls:
    post:
      operationId: swarm/peering/ls
      description: List peers registered in the peering subsystem.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-peering-ls
      parameters: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                Peers:
                - Addrs:
                  - <multiaddr-string>
                  ID: peer-id
      tags:
      - Swarm
  /api/v0/swarm/peering/rm:
    post:
      operationId: swarm/peering/rm
      description: Remove a peer from the peering subsystem.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-peering-rm
      parameters:
      - name: arg
        in: query
        description: ID of peer to remove from the peering subsystem
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                ID: <peer-id>
                Status: <string>
      tags:
      - Swarm
  /api/v0/swarm/peers:
    post:
      operationId: swarm/peers
      description: List peers with open connections.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-peers
      parameters:
      - name: verbose
        in: query
        description: display all extra information.
        schema:
          type: boolean
      - name: streams
        in: query
        description: Also list information about open streams for each peer.
        schema:
          type: boolean
      - name: latency
        in: query
        description: Also list information about latency to each peer.
        schema:
          type: boolean
      - name: direction
        in: query
        description: Also list information about the direction of connection.
        schema:
          type: boolean
      - name: identify
        in: query
        description: Also list information about peers identify.
        schema:
          type: boolean
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example:
                Peers:
                - Addr: <string>
                  Direction: <int>
                  Identify:
                    Addresses:
                    - <string>
                    AgentVersion: <string>
                    ID: <string>
                    ProtocolVersion: <string>
                    Protocols:
                    - <string>
                    PublicKey: <string>
                  Latency: <string>
                  Muxer: <string>
                  Peer: <string>
                  Streams:
                  - Protocol: <string>
      tags:
      - Swarm
  /api/v0/swarm/resources:
    post:
      operationId: swarm/resources
      description: Get a summary of all resources accounted for by the libp2p Resource Manager.
      externalDocs:
        url: https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-swarm-resources
      x-experimental: true
      parameters: []
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              example: <object>
      tags:
      - Swarm
externalDocs:
  url: https://docs.ipfs.tech/reference/kubo/rpc/