# 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 For more information about adding signatures to CIDs on IPFS please read the [Signatures Guide](/files/signatures). ## Usage ```typescript theme={null} import { PinataSDK } from "pinata-web3"; const pinata = new PinataSDK({ pinataJwt: process.env.PINATA_JWT!, pinataGateway: "example-gateway.mypinata.cloud", }); const signature = await pinata.signatures.private.add({ cid: "QmXGeVy9dVwfuFJmvbzz8y4dYK1TdxXbDGzwbNuyZ5xXSU", signature: "0x1b...911b", address: "0xB3899AA8E13172E48D44CE411b0c4c2f08730Dc6" }); ``` ## Returns ```typescript theme={null} type SignatureResponse = { cid: string; signature: string; }; ``` ## Parameters ### cid * Type: `string` Target CID that you want to add a signature to. ```typescript {2} theme={null} const signature = await pinata.signatures.private.add({ cid: "QmXGeVy9dVwfuFJmvbzz8y4dYK1TdxXbDGzwbNuyZ5xXSU", signature: "0x1b...911b", address: "0xB3899AA8E13172E48D44CE411b0c4c2f08730Dc6" }); ``` ### signature * Type: `0x${string}` EIP-712 Signature to be assigned to target CID. ```typescript {3} theme={null} const signature = await pinata.signatures.private.add({ cid: "QmXGeVy9dVwfuFJmvbzz8y4dYK1TdxXbDGzwbNuyZ5xXSU", signature: "0x1b...911b", address: "0xB3899AA8E13172E48D44CE411b0c4c2f08730Dc6" }); ``` ### address * Type: `0x${string}` Wallet address that made the signature ```typescript {4} theme={null} const signature = await pinata.signatures.private.add({ cid: "QmXGeVy9dVwfuFJmvbzz8y4dYK1TdxXbDGzwbNuyZ5xXSU", signature: "0x1b...911b", address: "0xB3899AA8E13172E48D44CE411b0c4c2f08730Dc6" }); ``` --- # Source: https://docs.pinata.cloud/sdk/types/analytics.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. # Analytics ### AnalyticsQuery ```typescript theme={null} export type AnalyticsQuery = { gateway_domain: string; start_date: string; end_date: string; cid?: string; file_name?: string; user_agent?: string; country?: string; region?: string; referer?: string; limit?: number; sort_order?: "asc" | "desc"; }; ``` ### TopAnalyticsQuery ```typescript theme={null} export type TopAnalyticsQuery = AnalyticsQuery & { sort_by: "requests" | "bandwidth"; attribute: | "cid" | "country" | "region" | "user_agent" | "referer" | "file_name"; }; ``` ### TopAnalyticsResponse ```typescript theme={null} export type TopAnalyticsResponse = { data: TopAnalyticsItem[]; }; ``` ### TopAnalyticsItem ```typescript theme={null} export type TopAnalyticsItem = { value: string; requests: number; bandwidth: number; }; ``` ### TimeIntervalAnalyticsQuery ```typescript theme={null} export type TimeIntervalAnalyticsQuery = AnalyticsQuery & { sort_by?: "requests" | "bandwidth"; date_interval: "day" | "week"; }; ``` ### TimePeriodItem ```typescript theme={null} export type TimePeriodItem = { period_start_time: string; requests: number; bandwidth: number; }; ``` ### TimeIntervalAnalyticsResponse ```typescript theme={null} export type TimeIntervalAnalyticsResponse = { total_requests: number; total_bandwidth: number; time_periods: TimePeriodItem[]; }; ``` ### UserPinnedDataResponse ```typescript theme={null} export type UserPinnedDataResponse = { pin_count: number; pin_size_total: number; pin_size_with_replications_total: number; }; ``` --- # Source: https://docs.pinata.cloud/account-management/api-keys.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. # API Keys This page is where you can create, record, and delete API keys for the [Pinata API](/api-reference/introduction). Creating an API key is very simple! Just visit the page to start by click on the API Keys button in the left sidebar, then click "New Key" in the top right. 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. Once API keys have been created, you will not be able to see the secret or JWT again Once you have created your keys you can go ahead and try testing them! You can even use them in our [API Reference section](/api-reference/endpoint/ipfs/test-authentication) :eyes: Or feel free to paste this into your terminal with your `JWT` ```bash cURL theme={null} curl --request GET \ --url https://api.pinata.cloud/data/testAuthentication \ --header 'accept: application/json' \ --header 'authorization: Bearer YOUR_PINATA_JWT' ``` If successful you should see this! ```shell bash theme={null} { "message": "Congratulations! You are communicating with the Pinata API!" } ``` ## Managing Keys From the Keys Page you can see the name of a key, the public key, when it was issues, how many max uses it has, and what permissions it was given. 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. If you are just getting started we recommend using Admin privileges, then move to scope keys as you better understand your needs 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 API keys are only shown once, be sure to copy them somewhere safe! After you have your API key, you will want to get your Gateway domain. When you create a Pinata account, you'll automatically have a Gateway created for you! To see it, simply visit the [Gateways Page](https://app.pinata.cloud/gateway) see it listed there. 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}
{#if url} pinnie {/if}
``` This component creates a `
` with a file `` as well as a `