Skip to content

Uploading and managing files on IPFS through Pinata's pinning service API. The project includes ready-to-use scripts for uploading JSON and image files, creating file groups, listing files, and generating IPFS URLs, making it easy for developers to integrate IPFS file storage into their applications using Pinata's infrastructure.

Notifications You must be signed in to change notification settings

joebertcerezo/ipfs-api-starter

Repository files navigation

Pinata File Upload Starter

This repo provides examples for uploading files to Pinata, a leading IPFS pinning service. It includes basic API calls to help you get started with uploading and managing files on IPFS through Pinata's platform.

Tip

If you plan to use Pinata in a Typescript/Javascript enviornment, check out SDK!

Getting Started

First follow these steps to create a free Pinata account and get your API key and Gateway URL.

By default this repo uses Bun.sh, so install this first unless you plan to run the files with another program.

Clone the repo to your machine and install the dependencies

git clone https://github.com/PinataCloud/files-api-starter

cd files-api-starter

bun install

Create a .env file in the root directory and add your Pinata JWT API key and Gateway URL:

PINATA_JWT=your_pinata_jwt_here
GATEWAY_URL=your_gateway_url_here

Usage

Upload files to Pinata using the following commands:

Upload JSON files to Pinata:

npm run upload

Upload image files to Pinata:

npm run upload-image <path-to-image>

For example:

npm run upload-image logo.png
npm run upload-image /path/to/your/image.png

Using Bun directly:

bun upload-file.ts

Additional Pinata operations:

Explore the other files in this repo for additional Pinata functionality:

  • list-files.ts - List files from your Pinata account
  • create-group.ts - Create file groups in Pinata
  • add-to-group.ts - Add files to existing groups
  • create-ipfs-url.ts - Generate IPFS URLs for your files

About

Uploading and managing files on IPFS through Pinata's pinning service API. The project includes ready-to-use scripts for uploading JSON and image files, creating file groups, listing files, and generating IPFS URLs, making it easy for developers to integrate IPFS file storage into their applications using Pinata's infrastructure.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •