Swarm API (0.6.0)

Download OpenAPI specification:Download

A list of the currently provided Interfaces to interact with the swarm, implementing file operations and sending messages

Bytes

Upload data

Authorizations:
header Parameters
swarm-tag
integer

Associate upload with an existing Tag UID

swarm-pin
boolean

Represents the pinning state of the chunk

swarm-encrypt
boolean

Represents the encrypting state of the file

swarm-postage-batch-id
required
string ^[A-Fa-f0-9]{64}$
Example: 36b7efd913ca4cf880b8eeac5093fa27b0825906c600685b6abdd6566e6cfe8f

ID of Postage Batch that is used to upload data with

Request Body schema: application/octet-stream
string <binary>

Responses

Response samples

Content type
application/json
{
  • "reference": "36b7efd913ca4cf880b8eeac5093fa27b0825906c600685b6abdd6566e6cfe8f"
}

Get referenced data

Authorizations:
path Parameters
required
string or string or string

Swarm address reference to content

Responses

Response samples

Content type
application/problem+json
"string"

Chunk

Get Chunk

Authorizations:
path Parameters
required
string or string or string

Swarm address of chunk

query Parameters
targets
string

Global pinning targets prefix

Responses

Response samples

Content type
application/problem+json
"string"

Upload Chunk

Authorizations:
header Parameters
swarm-tag
integer

Associate upload with an existing Tag UID

swarm-pin
boolean

Represents the pinning state of the chunk

swarm-postage-batch-id
required
string ^[A-Fa-f0-9]{64}$
Example: 36b7efd913ca4cf880b8eeac5093fa27b0825906c600685b6abdd6566e6cfe8f

ID of Postage Batch that is used to upload data with

Request Body schema: application/octet-stream
string <binary>

Responses

Response samples

Content type
application/json
{
  • "status": "string"
}

File

Upload file or a collection of files

In order to upload a collection, user can send a multipart request with all the files populated in the form data with appropriate headers.

User can also upload a tar file along with the swarm-collection header. This will upload the tar file after extracting the entire directory structure.

If the swarm-collection header is absent, all requests (including tar files) are considered as single file uploads.

A multipart request is treated as a collection regardless of whether the swarm-collection header is present. This means in order to serve single files uploaded as a multipart request, the swarm-index-document header should be used with the name of the file.

Authorizations:
query Parameters
name
string

Filename when uploading single file

header Parameters
swarm-tag
integer

Associate upload with an existing Tag UID

swarm-pin
boolean

Represents the pinning state of the chunk

swarm-encrypt
boolean

Represents the encrypting state of the file

Content-Type
string

The specified content-type is preserved for download of the asset

swarm-collection
boolean

Upload file/files as a collection

swarm-index-document
string
Example: index.html

Default file to be referenced on path, if exists under that path

swarm-error-document
string
Example: error.html

Configure custom error document to be returned when a specified path can not be found in collection

swarm-postage-batch-id
required
string ^[A-Fa-f0-9]{64}$
Example: 36b7efd913ca4cf880b8eeac5093fa27b0825906c600685b6abdd6566e6cfe8f

ID of Postage Batch that is used to upload data with

Request Body schema:
file
Array of strings <binary>

Responses

Response samples

Content type
application/json
{
  • "reference": "36b7efd913ca4cf880b8eeac5093fa27b0825906c600685b6abdd6566e6cfe8f"
}

Collection

Upload file or a collection of files

In order to upload a collection, user can send a multipart request with all the files populated in the form data with appropriate headers.

User can also upload a tar file along with the swarm-collection header. This will upload the tar file after extracting the entire directory structure.

If the swarm-collection header is absent, all requests (including tar files) are considered as single file uploads.

A multipart request is treated as a collection regardless of whether the swarm-collection header is present. This means in order to serve single files uploaded as a multipart request, the swarm-index-document header should be used with the name of the file.

Authorizations:
query Parameters
name
string

Filename when uploading single file

header Parameters
swarm-tag
integer

Associate upload with an existing Tag UID

swarm-pin
boolean

Represents the pinning state of the chunk

swarm-encrypt
boolean

Represents the encrypting state of the file

Content-Type
string

The specified content-type is preserved for download of the asset

swarm-collection
boolean

Upload file/files as a collection

swarm-index-document
string
Example: index.html

Default