Manage files
Upload and pin files across the IPFS network using Infura's API endpoints, custom tools, and libraries.
Infura doesn't currently support remote pinning services on IPFS Desktop.

Add a file

1
curl -X POST -F file=@myfile \
2
-u "PROJECT_ID:PROJECT_SECRET" \
3
"https://ipfs.infura.io:5001/api/v0/add"
4
5
> {
6
"Name":"ipfs_file_docs_getting_started_demo.txt",
7
"Hash":"QmeGAVddnBSnKc1DLE7DLV9uuTqo5F7QbaveTjr45JUdQn",
8
"Size":"44"
9
}
Copied!
When you add a file using the /api/v0/add endpoint, the file is automatically pinned, and it isn't necessary to pin again.

Pin a file

Pin a file to ensure it is always available on the IPFS network.
IPFS pinning allows you to retain and persist data on IPFS nodes. Pinning assures that data is accessible indefinitely, and not removed during the IPFS garbage collection process.
1
curl -X POST -u "PROJECT_ID:PROJECT_SECRET" \
2
"https://ipfs.infura.io:5001/api/v0/pin/add?arg=QmeGAVddnBSnKc1DLE7DLV9uuTqo5F7QbaveTjr45JUdQn"
Copied!
A pinned file will appear in your project's dashboard explorer. Unpin it at any time using the unpin button in the UI or with the following /pin/rm endpoint.

Unpin a file

1
curl -X POST -u "PROJECT_ID:PROJECT_SECRET" \
2
"https://ipfs.infura.io:5001/api/v0/pin/rm?arg=QmeGAVddnBSnKc1DLE7DLV9uuTqo5F7QbaveTjr45JUdQn"
Copied!

Upload a file with ipfs-upload-client

Infura's ipfs-upload-client is a command line tool for uploading files and directories to IPFS. Install the tool using the following steps:
  1. 1.
    Clone the ipfs-upload-client repository: git clone https://github.com/INFURA/ipfs-upload-client.git
  2. 2.
    Change to the ipfs-upload-client directory: cd ipfs-upload-client
  3. 3.
    Compile the source code to create a binary in the project folder: go build
Upload your files and directories to IPFS using the following syntax:
1
./ipfs-upload-client --id <project_id> --secret <project_secret> </path/to/data>
Copied!
By default, the tool also pins your uploaded file. You can override this default by setting --pin false. Read more about using the tool in this blog post.

Command flags

1
--id Infura project ID
2
--secret Infura project secret
3
--url The API URL (default "https://ipfs.infura.io:5001", set with --url <CUSTOM_URL>)
4
--pin Whether or not to pin the data (default true, set to false with --pin=false)
Copied!

Read a file

1
curl -X POST -u "PROJECT_ID:PROJECT_SECRET" \
2
"https://ipfs.infura.io:5001/api/v0/cat?arg=QmeGAVddnBSnKc1DLE7DLV9uuTqo5F7QbaveTjr45JUdQn"
3
4
> Infura IPFS - Getting started demo.
Copied!