Groups allow you to organize your Pinata content through the Pinata App or through the Files API, giving you a clearer picture of what your files are being used for.

Public vs Private Groups

Groups help determine if a file uploaded through the Files API is private or publicly accessible. All file uploads are private by default, unless a file is:

  • Uploaded to a public group
  • Added to a public group
  • Is part of a group that is updated to public

At this point the file can be accessed publicly without a signed URL. For more info read the docs on retrieving files.

Groups can either be public upon creation or updated after the fact, as laid out below.

Files SDK and API

With the Files SDK, you can create groups, add files to groups, list details about a group, and more! You can also mange groups using the Files API.

Create a Group

To create a group you can use the create method and passing in the name you want to give a group.

This will return the Group info

Add or Remove Files from a Group

There are two ways you can add files to a group. The first is to add the file to a group on upload.

Another option is to add files after the fact using the addFiles method.

Removing files can be done the exact same way with the removeFiles method.

Get a Group

To fetch details of an already existing group you can use the get and pass in the groupId.

This will return the same group info received upon creation.

List All Groups

If you want to get all Groups or filter through them, you can use the list method.

Results can be filtered with the following queries.

name

  • Type: boolean

Filters groups based on the group name

isPublic

  • Type: boolean

Filters groups based on whether they are public or not

limit

  • Type: number

Limits the number of results

This will return an array of Groups and their respective info:

Updating a Group

You can update the name of a group or it’s public status using the update method and passing in the groupId, a new nameyou want to use, or setting theisPublic` boolean.

This will return the updated Group info.

Delete a Group

Deleting a Group that has CIDs inside of it will not unpin/delete the files. Please use the delete method to actually delete a file from your account

To delete a Group you can use the delete method and pass in the groupId.

If successful the endpoint will return an OK response.