# Pinata
> ## Documentation Index
---
# Source: https://docs.pinata.cloud/api-reference/endpoint/add-file-to-group.md
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.
# Add File To Group
> `org:groups:write`
## OpenAPI
````yaml put /groups/{network}/{id}/ids/{file_id}
openapi: 3.0.0
info:
title: Pinata V3 API
version: 1.0.0
servers:
- url: https://api.pinata.cloud/v3
security:
- bearerAuth: []
paths:
/groups/{network}/{id}/ids/{file_id}:
put:
tags:
- Groups
summary: Add File To Group
description: |
`org:groups:write`
operationId: addFileToGroup
parameters:
- name: network
description: Target either the public or private IPFS network
in: path
schema:
type: string
enum:
- public
- private
required: true
example: public
- name: id
in: path
description: The ID of the target group
schema:
type: string
required: true
example: 01919ac8-a6f5-7e8e-a8a2-6cfe00122b90
- name: file_id
in: path
description: The ID of the tart file to add to the group
schema:
type: string
required: true
example: bc2aad39-2594-4353-9404-f59bc4118e2c
responses:
'200':
description: OK
headers:
Date:
schema:
type: string
example: Thu, 29 Aug 2024 15:17:52 GMT
Content-Type:
schema:
type: string
example: application/json; charset=utf-8
Content-Length:
schema:
type: integer
example: '136'
Connection:
schema:
type: string
example: keep-alive
X-Request-Id:
schema:
type: string
example: 5cee9f024755176365a202b6ce5d29e4
Strict-Transport-Security:
schema:
type: string
example: max-age=15724800; includeSubDomains
content:
application/json:
schema:
type: object
properties:
data:
type: object
example:
data: null
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
````
---
# Source: https://docs.pinata.cloud/sdk/groups/public/add-files.md
# Source: https://docs.pinata.cloud/sdk/groups/private/add-files.md
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.
# addFiles
> `org:groups:write`
Add private files to a private group
## Usage
```typescript theme={null}
import { PinataSDK } from "pinata";
const pinata = new PinataSDK({
pinataJwt: process.env.PINATA_JWT!,
pinataGateway: "example-gateway.mypinata.cloud",
});
const group = await pinata.groups.private.addFiles({
groupId: "3778c10d-452e-4def-8299-ee6bc548bdb0",
files: [
"7e18c4a4-9501-44de-8f81-403db7de0e39",
"a606ef7e-70a0-40ad-9b8a-60563e009655"
],
});
```
## Returns
```typescript theme={null}
type UpdateGroupFilesResponse[] = {
id: string;
status: string;
};
```
## Parameters
### groupId
* Type: `string`
ID of the target Group to add files to
```typescript {2} theme={null}
const group = await pinata.groups.private.addFiles({
groupId: "3778c10d-452e-4def-8299-ee6bc548bdb0",
files: [
"7e18c4a4-9501-44de-8f81-403db7de0e39",
"a606ef7e-70a0-40ad-9b8a-60563e009655"
],
});
```
### files
* Type: `string[]`
An array of file IDs as strings that you want to add to the group
```typescript {3-6} theme={null}
const group = await pinata.groups.private.addFiles({
groupId: "3778c10d-452e-4def-8299-ee6bc548bdb0",
files: [
"7e18c4a4-9501-44de-8f81-403db7de0e39",
"a606ef7e-70a0-40ad-9b8a-60563e009655"
],
});
```
---
# Source: https://docs.pinata.cloud/api-reference/endpoint/add-signature-to-cid.md
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.
# Add Signature to CId
> `org:files:write`
## OpenAPI
````yaml post /files/{network}/signature/{cid}
openapi: 3.0.0
info:
title: Pinata V3 API
version: 1.0.0
servers:
- url: https://api.pinata.cloud/v3
security:
- bearerAuth: []
paths:
/files/{network}/signature/{cid}:
post:
tags:
- default
summary: Add Signature to CId
description: |
`org:files:write`
parameters:
- name: cid
in: path
schema:
type: string
required: true
example: QmXGeVy9dVwfuFJmvbzz8y4dYK1TdxXbDGzwbNuyZ5xXSU
description: Target CID to add a signature to
- name: network
description: Target either the public or private IPFS network
in: path
schema:
type: string
enum:
- public
- private
required: true
example: public
requestBody:
content:
application/json:
schema:
type: object
properties:
signature:
type: string
description: Signature for the target CID
address:
type: string
description: Wallet address that made the signature
example:
address: '0xbC18447255e86f7f6c01C25e82636dDc587Ef9dc'
signature: >-
0x1ba6c2a8412dc9b0be37b013ea5bddd97251dab4d435cc9c4c7bcf331d4017ca2de07485ad6a15ce60d3700cee802787bc7ede0c112c7843f702bb1e71b750911b
responses:
'200':
description: OK
headers:
Date:
schema:
type: string
example: Mon, 22 Jul 2024 17:42:36 GMT
Content-Type:
schema:
type: string
example: application/json; charset=utf-8
Content-Length:
schema:
type: integer
example: '213'
Connection:
schema:
type: string
example: keep-alive
X-Request-Id:
schema:
type: string
example: 0c7bec7ab64236237a9eabef91645733
Strict-Transport-Security:
schema:
type: string
example: max-age=15724800; includeSubDomains
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
cid:
type: string
signature:
type: string
example:
data:
cid: QmXGeVy9dVwfuFJmvbzz8y4dYK1TdxXbDGzwbNuyZ5xXSU
signature: >-
0x1ba6c2a8412dc9b0be37b013ea5bddd97251dab4d435cc9c4c7bcf331d4017ca2de07485ad6a15ce60d3700cee802787bc7ede0c112c7843f702bb1e71b750911b
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
````
---
# Source: https://docs.pinata.cloud/sdk/files/public/add-swap.md
# Source: https://docs.pinata.cloud/sdk/files/private/add-swap.md
# Source: https://docs.pinata.cloud/api-reference/endpoint/add-swap.md
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.
# Add Swap
> `org:files:write`
## OpenAPI
````yaml put /files/{network}/swap/{cid}
openapi: 3.0.0
info:
title: Pinata V3 API
version: 1.0.0
servers:
- url: https://api.pinata.cloud/v3
security:
- bearerAuth: []
paths:
/files/{network}/swap/{cid}:
put:
tags:
- Swaps
summary: Add Swap
description: |
`org:files:write`
operationId: add-swap
parameters:
- name: network
description: Target either the public or private IPFS network
in: path
schema:
type: string
enum:
- public
- private
required: true
example: public
- name: cid
in: path
schema:
type: string
required: true
description: The target original CID
example: bafkreiccqfcxwp52uqwd7r5g7kdukgz7jvs6jcusetfnznj5jfch3r6wlm
requestBody:
content:
application/json:
schema:
type: object
required:
- swapCid
properties:
swapCid:
type: string
description: The CID you want to redirect to
example:
swapCid: bafkreig4zcnmqa23zff3ye7tuef6wrlq3aimffzm22axfeh3ddmawzlzz4
responses:
'200':
description: OK
headers:
Date:
schema:
type: string
example: Sun, 18 Aug 2024 19:36:29 GMT
Content-Type:
schema:
type: string
example: application/json; charset=utf-8
Content-Length:
schema:
type: integer
example: '114'
Connection:
schema:
type: string
example: keep-alive
X-Request-Id:
schema:
type: string
example: 576d0cc3a1b66e3b8938c90e0f45f3a7
Strict-Transport-Security:
schema:
type: string
example: max-age=15724800; includeSubDomains
content:
application/json:
schema:
type: object
properties:
data:
type: object
properties:
mapped_cid:
type: string
description: >-
The current CID that is being pointed to from the
original
created_at:
type: string
description: The date this CID was updated
example:
data:
mapped_cid: bafkreig4zcnmqa23zff3ye7tuef6wrlq3aimffzm22axfeh3ddmawzlzz4
created_at: '2024-09-20T17:09:39.490275Z'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
````
---
# Source: https://docs.pinata.cloud/sdk/x402/cids/add.md
# Source: https://docs.pinata.cloud/sdk/signatures/public/add.md
# Source: https://docs.pinata.cloud/sdk/signatures/private/add.md
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.
# add
> `org:files:write`
Add an EIP-712 signature to a CID
In the New Key modal you can choose if you want the key to be an Admin key and have full access over every endpoint, or scope the keys by selecting which endpoints you want to use. You can also give it a limited number of uses, and be sure to give it a name to keep track of it. Once you have that filled out click "Create Key" and it will show you the `pinata_api_key`, `pinata_api_secret_key`, and the `JWT`. It's best to click "Copy All" and keep the API key data safe and secure.
At any point you can delete an API key by clicking on the Revoke button
---
# Source: https://docs.pinata.cloud/frameworks/astro.md
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.
# Astro
> Get started using Pinata with Astro
This guide will walk you through setting up Pinata with Astro
## Create an API Key and get Gateway URL
To create an API key, visit the [Keys Page](https://app.pinata.cloud/developers/keys) and click the "New Key" button in the top right. Once you do that you can select if you want your key to be admin or if you want to scope the privileges of the keys to certain endpoints or limit the number of uses. Make those selections, then give the key a name at the bottom, and click create key.
Once you have created the keys you will be shown your API Key Info. This will contain your **Api Key**, **API Secret**, and your **JWT**. Click "Copy All" and save them somewhere safe!
The gateway domains are randomly generated and might look something like this:
```
aquamarine-casual-tarantula-177.mypinata.cloud
```
## Setup Astro
To create a new Astro project go ahead and run this command in the terminal:
```bash theme={null}
npm create astro@latest pinata-astro
```
You can select which options you prefer, but for this exmaple we'll use the following:
```
tmpl How would you like to start your new project?
Empty
ts Do you plan to write TypeScript?
Yes
use How strict should TypeScript be?
Strict
deps Install dependencies?
Yes
git Initialize a new git repository?
Yes
```
After completing the project setup we can go ahead and `cd` into the repo and install `pinata`.
```bash theme={null}
cd pinata-astro && npm i pinata
```
Since we want to keep our API key private we will need to make sure our code is deployed server side, and we can use several different adapter options which you can view [here](https://docs.astro.build/en/guides/server-side-rendering/). We also need a UI framework to handle our upload form, and there are many to choose from [here](https://docs.astro.build/en/guides/framework-components/). We'll use `vercel` and `svelte` for this tutorial, and you can install them like so.
```bash theme={null}
npx astro add vercel svelte
```
This should install the dependencies and alter the `astro.config.mjs` for us.
## Setup Pinata
In the `src` folder make a new folder called `utils`, and inside there make a file called `pinata.ts` with the following contents:
```typescript src/utils/pinata.ts theme={null}
import { PinataSDK } from "pinata";
export const pinata = new PinataSDK({
pinataJwt: import.meta.env.PINATA_JWT,
pinataGateway: import.meta.env.GATEWAY_URL,
});
```
This will create and export an instance of the Files SDK using environment variables, and to set those up make a new file at the root of the project called `.env` with the following values:
```
PINATA_JWT= # The Pinata JWT API key we got earlier
GATEWAY_URL= # The Gateway domain we grabbed earlier, formatting just as we copied it from the app
```
## Create Client Side Form
In the `src` folder make another folder called `components`, then inside there make file called `UploadForm.svelte`.
```html src/components/UploadForm.svelte theme={null}