Skip to main content

Aggregator

The aggregator reads blobs from the storage nodes, checks every sliver, decodes them and serves them over HTTP. It also serves single files of a quilt and the status of the network.

Base URL: https://aggregator.iotastorage.com. Public, without authentication, with CORS (access-control-allow-origin: *).

MethodPathReturns
GET, HEAD/v1/blobs/<blob ID>The blob.
GET, HEAD/v1/blobs/by-object-id/<object ID>The blob of a Blob object.
GET, HEAD/v1/blobs/by-quilt-patch-id/<quilt patch ID>One file (patch) of a quilt.
GET, HEAD/v1/blobs/by-quilt-id/<quilt blob ID>/<identifier>One file of a quilt, by its identifier.
GET/v1/quilts/<quilt blob ID>/patchesThe list of files of a quilt.
GET/v1/statusStatus of the network.

Read a blob​

curl -o file https://aggregator.iotastorage.com/v1/blobs/<blob ID>
curl -o file https://aggregator.iotastorage.com/v1/blobs/by-object-id/0x<object ID>

The response is the content of the blob, with these headers:

HeaderValue
content-typeapplication/octet-stream
content-lengthSize of the blob.
etagThe blob ID, in quotes. The content of a blob ID never changes.
cache-controlpublic, max-age=86400, stale-while-revalidate=3600
x-content-type-optionsnosniff
accept-rangesbytes

HEAD returns the same headers without the body.

Browsers and caches can keep a blob for a day and then revalidate it with its etag: with If-None-Match and that etag, the answer is 304 without the body, as long as the blob is still on the network (the aggregator has it in its cache or a node has it). The content of a blob ID never changes, but a blob can be deleted or expire: that is why it is not cached forever.

A blob is served as it is, as application/octet-stream with nosniff: the browser does not interpret it (an HTML blob is offered as a download, not shown as a page); to show files in a browser, publish a site. A blob that the operator blocks afterwards (see the terms of use) stops being served, but the copies that browsers, proxies or other people already downloaded are out of its reach.

With a Range header of a single range (bytes=0-1023, bytes=1024- or bytes=-100, the last 100 bytes), the answer is 206 with only those bytes and content-range; one that starts past the end, 416. Several ranges, or an invalid one, give the whole blob (200). With If-Range, the range is only served if it matches the etag. Quilt files accept it too.

  • By object ID, the aggregator reads the Blob object on IOTA to get its blob ID. If there is no Blob with that ID, it answers 404.
  • Every sliver is checked against the blob's metadata, which are checked against the blob ID, as it arrives. One that does not match is discarded and another one is requested, so a node with corrupted data does not stop the read. After decoding, every row of the blob is checked against the metadata too, so the aggregator only serves the content the blob ID commits to.
  • The largest blob is 149,286,452 bytes (about 142 MiB) with 100 shards.

Read a file of a quilt​

A file stored in a quilt can be read by its quilt patch ID or by the blob ID of the quilt and the file's identifier:

curl https://aggregator.iotastorage.com/v1/blobs/by-quilt-patch-id/<quilt patch ID>
curl https://aggregator.iotastorage.com/v1/blobs/by-quilt-id/<quilt blob ID>/index.html

The identifier can contain slashes, encoded as %2F or not. The files of a site use their path as identifier, starting with /: /index.html is read at …/by-quilt-id/<quilt blob ID>/%2Findex.html. The response has the same headers as a blob, except:

  • etag is the quilt patch ID;
  • x-quilt-patch-identifier is the identifier of the file (URL-encoded if it is not ASCII).

If the blob is not a quilt, or it has no such patch, the answer is 404.

The aggregator does not read the whole quilt: only its index and the columns of the file, which are secondary slivers, each one checked against the quilt's metadata. If a node does not give one of them, it reads the whole quilt instead and checks those columns against the metadata too, so a file is the same whichever way it is read.

List the files of a quilt​

curl https://aggregator.iotastorage.com/v1/quilts/<quilt blob ID>/patches
[
{ "identifier": "index.html", "patch_id": "<quilt patch ID>", "tags": {} },
{ "identifier": "logo.svg", "patch_id": "<quilt patch ID>", "tags": { "kind": "image" } }
]

tags are the tags stored with each file, if any (see the publisher). Like a blob, the list is at most 32 MiB; a longer one gets a 413.

Network status​

GET /v1/status is specific to IOTA Storage. It returns the current epoch, the shards, the largest blob, the committee and whether the network is paused:

curl https://aggregator.iotastorage.com/v1/status
{
"epoch": 1,
"shards": 100,
"maxBlobSize": 149286452,
"nodes": [
{ "name": "node-4", "networkAddress": "node-4.iotastorage.com:443", "shards": 25 },
{ "name": "node-1", "networkAddress": "node-1.iotastorage.com:443", "shards": 25 },
{ "name": "node-3", "networkAddress": "node-3.iotastorage.com:443", "shards": 25 },
{ "name": "node-2", "networkAddress": "node-2.iotastorage.com:443", "shards": 25 }
],
"publisher": { "address": "0x…", "maxSize": 10485760, "maxEpochs": 53, "withToken": true },
"pausedUntil": null,
"blocklist": { "sha256": "…", "bot": { "sha256": null, "sites": 0, "blobs": 0, "paused": [] }, "failed": false, "blobs": 0, "deletions": 0, "sites": 0, "names": 0, "sitesPaused": false, "sitesReview": 12, "sitesByName": false, "filesPaused": false, "appPaused": false }
}
FieldMeaning
epochCurrent epoch.
shardsNumber of shards of the network.
maxBlobSizeLargest blob, in bytes.
nodesCommittee of the epoch: name, network address registered on IOTA and number of shards of each node.
publisherIf this server also publishes: its IOTA address, the largest blob it accepts (maxSize), the most epochs (maxEpochs) and whether it requires a token (withToken). null otherwise.
pausedUntilIf the network is paused, the epoch at whose start the pause ends: until then nothing new is stored. null otherwise.
blocklistWith what list of its operator this server serves, as in the /v1/health of a node: the SHA-256 of the file, the list of the operator's bot (bot), whether a newer one could not be read, its figures and its switches. null without a list.

The aggregator reuses the response for 10 seconds, so it can lag up to 10 seconds behind the chain.

Errors​

Errors are JSON:

{ "error": { "status": "NOT_FOUND", "code": 404, "message": "…" } }
CodestatusWhen
400INVALID_ARGUMENTMalformed blob ID, object ID, quilt patch ID or identifier.
404NOT_FOUNDThe nodes do not have the blob (never stored, expired or deleted): nodes holding a quorum of shards say so. The aggregator remembers it for 5 seconds. Also: no Blob with that object ID, not a quilt or no such patch, or unknown path.
405METHOD_NOT_ALLOWEDWrong method for the path.
413PAYLOAD_TOO_LARGEThe blob is larger than what this aggregator reads in one request (32 MiB). For a file of a quilt, what counts is the size of its columns, not of the quilt; for the list of files of a quilt, the size of the list.
429RESOURCE_EXHAUSTEDToo many requests from the same IP, or too many of its reads waiting at once (each IP takes its turn, and an IPv6 address also counts by its /48). Try again in a few seconds.
451PERMISSION_DENIEDThe operator of this aggregator has blocked the blob, after a notice or an order about it (legal notice). Also for the files of a blocked quilt.
503UNAVAILABLEToo many nodes did not answer to know whether they have the blob, or not enough primary slivers could be read from them, or not in time (a read has 30 seconds plus 1 second per 100 KB of the blob once its turn comes). Also when the aggregator is busy with the reads of many clients, or cannot query the IOTA node (by-object-id), or its operator has paused the files for maintenance (files are neither stored nor served during maintenance: the network keeps them). Try again later.

Current limitations​

  • It does not yet return the headers that come from the attributes of a Blob or from the tags of a patch.