Pin Existing IPFS Content
Use the Flap Pin By CID API when a file or directory is already available on Public IPFS but is not yet retained by the Flap Pinata account. After the pin finishes, Flap applications and approved Vault UIs can load the content through the Flap IPFS gateway.
This API imports an existing CID. It does not upload local files or create a CID for you.
When to use this API
Use it when:
You already have a public IPFS CID.
The content works through its original IPFS provider but the Flap gateway reports that it is not pinned by the gateway owner.
A custom Vault UI needs an immutable image that must be available through the Flap gateway.
For a new token image and metadata JSON that have not been uploaded yet, use the token metadata upload flow instead.
Requirements
Before submitting a request:
Confirm that the content is available on Public IPFS.
Copy the complete raw CID exactly as returned by the original provider.
Keep the original provider pin active until Flap reports
pinnedand the content works through the Flap gateway.Submit only a raw CIDv0 or base32 CIDv1 value.
Do not submit an ipfs:// URI, a gateway URL, or a path below the CID.
Submit a CID
The public endpoint does not require a caller API key. Flap's Pinata credential remains on the server and must never be included in a request.
Request body:
The CID above is intentionally shortened for documentation. Replace it with the complete raw CID returned by your IPFS provider when making a request.
cidis required.nameis optional and is used only as an operator-friendly Pinata label.
Example with cURL:
The API returns 202 Accepted while Pinata is processing a new request. If the CID is already pinned or already being processed, the API returns the existing result instead of creating a duplicate job. A CID that is already pinned returns 200 OK.
Example response:
Check the pin status
Example:
The stable Flap statuses are:
queued
Pinata is prechecking the CID.
retrieving
Pinata found the content and is retrieving it.
processing
Pinata is still processing the request.
pinned
The content is retained by the Flap Pinata account.
failed
Pinata could not complete the request. Check errorCode.
not_found
Flap has no active or completed Pinata record for the CID.
Pinning is asynchronous. Poll at a reasonable interval and do not treat the initial 202 response as completion.
Verify through the Flap gateway
After the status becomes pinned, verify the content through the Flap gateway:
Only remove the original provider pin after at least one real file has loaded successfully through the Flap gateway.
Files and directories
For one existing image, submit its image CID once.
For an existing IPFS directory, submit the directory CID once. Do not submit every file path below it.
If every image has a separate CID, each CID is a separate Pin request; this API does not combine them into a directory.
Browser and server usage
The endpoint is public but does not enable wildcard browser CORS. Call it from a command-line client or your server, not directly from arbitrary browser JavaScript.
Troubleshooting
400 INVALID_REQUEST
Copy the complete raw CID again. Remove any gateway URL, ipfs:// prefix, or file path.
413 REQUEST_TOO_LARGE
Send only the small JSON body containing cid and optional name. Do not upload file bytes to this endpoint.
status: failed
Inspect errorCode and confirm the original provider still serves the content on Public IPFS.
502, 503, or 504
The upstream Pinata service rejected, rate-limited, or timed out. Retry later.
The endpoint itself returns an HTML 404 page
The deployed Flap Edge Functions release does not include this API yet. Contact Flap before retrying.
The Flap gateway still cannot load the content
Wait until the API reports pinned, then verify the exact CID and optional directory path again.
Last updated