Pinning
Pin Files or Directory
This API allows you to pin a file to IPFS using the provided pinning API key and secret key.
Example metadata:
{
"name": "sample name",
"keyvalues": {
"key1": "value1",
"key2": "value2"
}
}Example options (optional):
{
"cid_version": 1,
"wrap_with_directory": false,
"vectorize": true
}| Option | Description |
|---|---|
cid_version | CID version of the pinned file. |
wrap_with_directory | Wrap the uploaded file in a directory. |
vectorize | Set to true to create File Vectors for a single text file, so you can search it by meaning. The response then contains vectorize_status: "queued". |
Vector Status
Every pin object returned by the endpoints on this page has a vectorize_status field. It tells you whether the file can be found with File Vectors. The values are not_requested (the default), queued, processing, completed, failed, and deleted. See Vector Status for what each value means and how failed files are retried.
vectorize_status is separate from status. status is the pinning state of the file, and vectorize_status is the search indexing state.
Headers
Body
Response
curl --location --request POST 'https://api.aiozpin.network/api/pinning/' \
--header 'pinning_api_key: KEY' \
--header 'pinning_secret_key: SECRET' \
--form 'file=@"/test.png"'Pin by CID
The request body when pin a file by CID will look like this:
{
"hash_to_pin": "CID",
"metadata": {
"name": "string",
"keyvalues": {
"key1": "value1",
"key2": "value2"
}
},
"pin_options": {
"vectorize": false
}
}pin_options is optional. Set pin_options.vectorize to true to create File Vectors for the file once it is pinned. The file must be a supported text file.
Headers
Body
Response
curl --location --request POST 'https://api.aiozpin.network/api/pinning/pinByHash' \
--header 'pinning_api_key: KEY' \
--header 'pinning_secret_key: SECRET' \
--header 'Content-Type: application/json' \
--data-raw '{
"hash_to_pin": "Qmc1135ziMvmFG534i75E8HpJoLqzLzgKBxfjBV9cBsMAs",
"metadata": {
"name": "name-ipfs-hash"
}
}'Get Pin Details by pinID
This code snippet makes a GET request to the /pinning/{pinId} endpoint, where {pinId} is the ID of the pin you want to retrieve information for.
Parameters
Headers
Response
curl --location --request GET 'https://api.aiozpin.network/api/pinning/3c3fec2a-ca65-4b8e-bcf3-c8e2ceaa23d2' \
--header 'pinning_api_key: KEY' \
--header 'pinning_secret_key: SECRET' List Pins of User
Query
Headers
Response
curl --location --request GET 'https://api.aiozpin.network/api/pinning/pins/?offset=0&limit=10&pinned=true&sortBy=name&sortOrder=ASC' \
--header 'pinning_api_key: KEY' \
--header 'pinning_secret_key: SECRET'Remove Files (Unpin)
Unpinning a file does not delete its file vectors. To remove the file from query results, call Delete File Vectors.
Parameters
Headers
Response
curl --location --request DELETE 'https://api.aiozpin.network/api/pinning/unpin/e5c4456d-5e5c-465d-a02a-3a536fc6e718' \
--header 'pinning_api_key: KEY' \
--header 'pinning_secret_key: SECRET'See Also
- File Vectors - search your pinned text files by meaning.
- Getting upload status - check the status of an upload.
- SDKs - pin with the SDK or the pinning CLI.
- Limit - rate limits.
- Payment - the free pin allowance and storage pricing.