Skip to content

Quick Start

Upload your first file to IPFS in under two minutes.

Upload page with drag-and-drop file upload

1. Get your API key

Sign up at ipfs.ninja with your Google account. A default API key is created automatically. Go to your Profile page to view and manage your API keys.

WARNING

Note: API keys don't expire. You can create multiple keys and revoke them individually from your Profile page.

2. Upload a file

Send a POST request to /upload/new with your content. Here's an example uploading a JSON object:

curl

bash
curl -X POST https://api.ipfs.ninja/upload/new \
  -H "X-Api-Key: bws_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "content": {
      "name": "My NFT",
      "description": "A permanent file on IPFS",
      "image": "ipfs://QmExampleCID..."
    },
    "description": "NFT metadata"
  }'

JavaScript

javascript
const response = await fetch("https://api.ipfs.ninja/upload/new", {
  method: "POST",
  headers: {
    "X-Api-Key": "bws_your_api_key_here",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    content: {
      name: "My NFT",
      description: "A permanent file on IPFS",
      image: "ipfs://QmExampleCID..."
    },
    description: "NFT metadata"
  })
});

const data = await response.json();
console.log(data.cid);       // "QmXmCX9S6ANV..."
console.log(data.uris.url);  // "https://ipfs.ninja/ipfs/QmXmCX9S6ANV..."

The API returns the CID, file size, and access URIs:

json
{
  "cid": "QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN",
  "sizeMB": 0.001,
  "uris": {
    "ipfs": "ipfs://QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN",
    "url": "https://ipfs.ninja/ipfs/QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN"
  }
}

3. Retrieve your file

Access your file in two ways:

Via the IPFS gateway (public, no auth needed)

bash
curl https://ipfs.ninja/ipfs/QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN

Via the API (returns file metadata)

bash
curl https://api.ipfs.ninja/file/QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN \
  -H "X-Api-Key: bws_your_api_key_here"

Response:

json
{
  "cid": "QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN",
  "fileName": "NFT metadata",
  "fileType": "json",
  "sizeMB": 0.001,
  "createdAt": 1711036800000,
  "uris": {
    "ipfs": "ipfs://QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN",
    "url": "https://ipfs.ninja/ipfs/QmXmCX9S6ANVjYJh3rJmXjqgYtYv7WZLUDL2XCwdPrvUwN"
  }
}

Next steps

  • API Reference — Full documentation for all endpoints, parameters, and error codes.
  • Dedicated Gateways — Get a private gateway that only serves your files. Available on the Nirvana plan.