📌Pin Files

APIs related to pin files

Endpoint

All url in the sample code below should start with https://pingo.to/api, for example, when you see a url as "/pin/cid", the full endpoint is "https://pingo.to/api/pin/cid".

Authorization

All the APIs below use Bearer token authorization. You should put:

{
    "Authorization": "Bearer <your api token>"
}

in the request header. You can create/manage your API tokens in the "Access Tokens" page in Pingo.to website.

The Status Field

The status field in the response has 4 possible values:

  • Pending - request has been sent, but Pingo hasn't started to pin it yet

  • Pinning - Pingo is pinning this cid across all requested servers

  • Pinned - Pingo finished pinning this cid in all requested servers. This also means the status field in the servers array are all changed to 3.

  • Failed - Pingo failed to pin this cid after trying several times. This could be a result of, for example, Pingo can't find this cid from IPFS peers. If you are sure this cid exists, you could issue a re-pin request. See the repin API below.

Pin an existing cid

💡 Click the ">" on the right of the card to see API details.

Send a request to pin an IPFS cid

POST /pin/cid

Content-Type: application/json

Request Body

Name
Type
Description

name*

String

file name

cid*

String

ipfs cid

Sample code (Javascript):

Pin a file via uploading

💡 Click the ">" on the right of the card to see API details.

Send a request to pin a file via uploading

POST /pin/file

Content-Type: multipart/form-data

Request Body

Name
Type
Description

file*

FormData

file form data to upload

Sample code (Javascript):

Pin some plain text directly

💡 Click the ">" on the right of the card to see API details

Send a request to pin text directly

POST /pin/text

Content-Type: application/json

Request Body

Name
Type
Description

name*

String

file name

content*

String

text you want to pin

Sample code (Javascript):

➡️arrow-up-right Get Pin Files

Get account pin files

💡 Click the ">" on the right of the card to see API details

Get account's pin file list

GET /pin/files

Query Parameters

Name
Type
Description

page

Number

fetch pins in this page number, default value is 1

count

Number

how many pins to get in this one page, default value is 20, max is 100

Sample code (Javascript):

➡️arrow-up-right Change Pin-File Name

Change a pin-file name.

💡 Click the ">" on the right of the card to see API details

Change name by cid

PUT /pin/cid/<cid>/name

Content-Type: application/json

Path Parameters

Name
Type
Description

cid*

String

file cid's name to change

Request Body

Name
Type
Description

name*

String

new name

Sample code (Javascript):

➡️arrow-up-right Delete Pin Cid

Delete a pinned Cid.

💡 Click the ">" on the right of the card to see API details

Delete / Unpin a pinned Cid. The current Cid's pin status must be "Pinned".

DELETE /pin/cid/<cid>

Path Parameters

Name
Type
Description

cid

String

cid to delete/unpin

Sample code (Javascript):

When you called the "Pin Cid" API above, Pingo will try many times to search Cid across the IPFS nodes and try to fetch that file to Pingo server. However, sometimes it may end up with "failed" to pin, e.g. this Cid doesn't exist across the IPFS nodes thus Pingo failed to find it. But if you are sure this Cid exists, you can make this re-pin API call to try to pin this Cid again.

💡 Click the ">" on the right of the card to see API details

Repin a Cid. To repin a Cid, the current pin status must be "Failed".

POST /repin/cid

Content-Type: application/json

Request Body

Name
Type
Description

cid*

String

Cid to repin

Sample code (Javascript):

Last updated