← home · openapi.json

Faux IPFS API

Everything under /api/files, /pinning and /data belongs to the owner and needs Authorization: Bearer <OWNER_TOKEN>. Reads under /ipfs/ are open unless a gateway token is set.

curl -H "Authorization: Bearer $OWNER_TOKEN" -F file=@photo.jpg https://ipfs.slopscore.org/api/files
curl https://ipfs.slopscore.org/ipfs/<cid>
curl "https://ipfs.slopscore.org/ipfs/<cid>?verify=false"

GET /ipfs/{cid}

Read a pinned file, or a folder (redirects to the slash form, then serves index.html or a listing). Bytes are checked against the CID as they stream, unless verify=false.

Auth: open, or GATEWAY_TOKEN when it is set

cidpathCIDv0 (Qm...) or CIDv1 (bafy..., bafk...)
verifyqueryfalse = pass the bytes through without hashing (default from VERIFY_DEFAULT)
downloadquerytrue = Content-Disposition: attachment
filenamequeryname for the download
formatqueryraw = the root block, for clients that verify it themselves
gatewayTokenqueryneeded when GATEWAY_TOKEN is set (also pinataGatewayToken, or the x-gateway-token header)
Rangeheaderbytes=a-b, answered 206

Returns: 200/206 the file, with Etag, X-Ipfs-Path, X-Ipfs-Roots, immutable Cache-Control, X-Faux-Verify: verified|skipped and X-Faux-Cache: HIT|MISS (verified responses are kept in the edge cache). 404 if not pinned here.

GET /ipfs/{cid}/{path}

A file or subfolder inside a pinned folder. Every folder node on the way is hashed against the CID that points to it.

Auth: open, or GATEWAY_TOKEN when it is set

pathpathe.g. img/photo.jpg; a folder path ends in /
verifyqueryfalse = no hashing

Returns: 200/206 the file; a folder gives its index.html or a listing; 404 if the path isn't in the folder

HEAD /ipfs/{cid}

The same headers as GET, no body.

Auth: open, or GATEWAY_TOKEN when it is set

Returns: 200

POST /api/files

Upload and pin a file. Returns its CID, the same one `ipfs add` would give.

Auth: Authorization: Bearer <OWNER_TOKEN>

Body: multipart/form-data: file (required), name, cidVersion (0|1), keyvalues (JSON). For a folder, send several file parts whose filenames carry the path (site/index.html, site/img/a.png): the folder gets the CID `ipfs add -r` gives. Or a raw body with ?name=&cidVersion=

Returns: 201 {cid, kind (file|dir), name, size, type, cidVersion, created, keyvalues, files (folders), url, isDuplicate}; 200 with isDuplicate: true if already pinned

GET /api/files

List pinned files.

Auth: Authorization: Bearer <OWNER_TOKEN>

limitqueryup to 1000 (default 100)
cursorqueryfrom the previous page

Returns: 200 {files: [{cid, name, size, created}], cursor}

GET /api/files/{cid}

One file's record.

Auth: Authorization: Bearer <OWNER_TOKEN>

Returns: 200 the record; 404 if not pinned

PATCH /api/files/{cid}

Rename, or merge keyvalues. The CID never changes.

Auth: Authorization: Bearer <OWNER_TOKEN>

Body: JSON {name?, keyvalues?}

Returns: 200 the record

DELETE /api/files/{cid}

Unpin and delete a file or folder, with all its stored objects and blocks.

Auth: Authorization: Bearer <OWNER_TOKEN>

Returns: 200 {deleted}; 404 if not pinned

POST /pinning/pinFileToIPFS

Legacy pinning-API alias: upload (file, pinataMetadata, pinataOptions.cidVersion), for existing SDK calls.

Auth: Authorization: Bearer <OWNER_TOKEN>

Body: multipart/form-data

Returns: 200 {IpfsHash, PinSize, Timestamp, isDuplicate}

POST /pinning/pinJSONToIPFS

Legacy pinning-API alias: pin a JSON value.

Auth: Authorization: Bearer <OWNER_TOKEN>

Body: JSON {pinataContent, pinataMetadata, pinataOptions}

Returns: 200 {IpfsHash, PinSize, Timestamp, isDuplicate}

DELETE /pinning/unpin/{cid}

Legacy pinning-API alias: delete.

Auth: Authorization: Bearer <OWNER_TOKEN>

Returns: 200 OK

GET /data/pinList

Legacy pinning-API alias: list.

Auth: Authorization: Bearer <OWNER_TOKEN>

Returns: 200 {count, rows: [{ipfs_pin_hash, size, date_pinned, metadata}]}

GET /data/testAuthentication

Check a token.

Auth: Authorization: Bearer <OWNER_TOKEN>

Returns: 200

POST /demo/pin

Demo only (when DEMO is set): pin a short text. Up to 5,000 characters of English letters, numbers, spaces, newlines and . , ! ? ' " - : ; ( ).

Auth: none (only exists when DEMO is set)

Body: JSON {text}

Returns: 201/200 {cid, url, size, isDuplicate}; 400 if the text breaks the rules; 404 when DEMO is off