Skip to main content

Arttribute Collections

What is an Arttribute Collection?

An Arttribute Collection is a foundational concept within the Arttribute platform, encompassing a curated grouping of Arttribute Items. Arttribute Collections serve as fundamental units for artists and creators to exhibit their work, organize attributes, and engage with the broader community of art enthusiasts and AI practitioners.

Key features of an Arttribute Collection include:

FeatureDescription
idUnique Identifier of an collection.
titleThe title or name of the collection.
descriptionA detailed description of the collection.
itemsThe items in the collection.
tagsA list of descriptive tags associated with the collection.
isPublicWhether the collection is public or not.
ownerOwner of an collection
projectInformation about the project associated with the collection.
licenseObject conataining licensing information of the collection. See our list of supported licenses to check what values this field can take
pricePrice information of the collection. See our supported currencies to check what values this field can take
needsRequestIndicates whether access to the collection requires a request or permission from the owner.
createdWhen the collection was created (ISO 8601 timestamp)
updatedWhen the collection was last updated (ISO 8601 timestamp)

Creating an Arttribute Collection

Step 1: Obtain your API Key

Before you can integrate this functionality into your application, you'll need an API key. This key is essential for authenticating your requests and gaining access to the Arttribute's features. To obtain an API key, follow the steps in the Generating Keys section

Step 2: Obtain an access token

The collections resource of the Arttribute API requires an access token to identify the user on whose behalf the application is creating or interacting with art collections. This user should be an Arttribute user and should have a registered wallet. See how to Generating access tokens. If an access token is not provided, the collection will be added under the account of the user who generated the API Key provided

tip

Prompt the user to sign a message with a wallet registered under Arttribute. This process authenticates the user and generates an access token that your application can use for subsequent requests.

Step 3: Make API request

With your API key and access token in hand, you can start make a request to add an collection on the Arttribute platform. We've provided code snippets below that demonstrate how to structure your API request.

Making a Node JS request with axios
const axios = require("axios");
let data = {
title: "Copper Collective",
description: "Collection of copper paintings",
isPublic: true,
tags: ["copper", "art"],
price: {
amount: 12,
currency: "cUSD",
},
license: ["ATR", "NCM"],
needsRequest: false,
};

axios
.request({
method: "post",
url: "https://api.arttribute.io/v1/collections", //TODO: Change this to API base url variable
headers: {
"x-api-key": "17eoF8...",
"Content-Type": "application/json",
Authorization: "Bearer eyJhbGciOiJIU...",
},
data: JSON.stringify(data),
})
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});

Exploring Additional Functionality

In this section, we'll walk you through how to:

  • Fetch information about a collection
  • Retrieve information about multiple collections
  • Update a collection
    • Change the visibility
    • Add an item to the collection
    • Remove an item from the collection
  • Delete a Collection

Fetching a single collection

To retrieve detailed information about a specific collection, you can use the GET /v1/collections/:id endpoint, where :id represents the unique identifier of the collection you want to fetch. Here's an example request:

Making a Node JS request with axios
const axios = require("axios");

let config = {
method: "get",
maxBodyLength: Infinity,
url: "https://api.arttribute.io/v1/collections/:id", //TODO: Change to url var
};

axios
.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});

Replace :id with the actual ID of the art collection you wish to retrieve. The response will contain comprehensive details about the collection as described in the introduction section.

Fetching multiple collections

To fetch all collections, you can use the GET /v1/collections endpoint.

Making a Node JS request with axios
const axios = require("axios");

axios
.request({
method: "get",
maxBodyLength: Infinity,
url: "https://api.arttribute.io/v1/collections",
})
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});

This request will retrieve all collections.

Updating a collection

This section provides details for three functionalities to update a collection as follows:

note

Auth required: Access token

Change the visibility of a collection

This request allows you to change the visibility of a collection between public and private using PATCH /v1/collections/:id endpoint, where :id represents the unique identifier of the collection you want to update. Also, pass the isPublic variable in the body.

Making a Node JS request with axios
const axios = require("axios");
let data = {
isPublic: true,
};

axios
.request({
method: "patch",
maxBodyLength: Infinity,
url: "https://api.arttribute.io/v1/collections/:id",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer eyJhbGciOiJIU...",
},
data: JSON.stringify(data),
})
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});

Add an item to a collection

This request allows you to add an item to a collection using PATCH /v1/collections/:id/items endpoint, where :id represents the unique identifier of the collection you want to update. Also, pass the itemId variable in the body.

Making a Node JS request with axios
const axios = require("axios");
let data = {
itemId: "05d7cd...",
};

axios
.request({
method: "patch",
maxBodyLength: Infinity,
url: "https://api.arttribute.io/v1/collections/:id/items",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer eyJhbGciOiJIU...",
},
data: JSON.stringify(data),
})
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});

Remove an item from a collection

This request allows you to add an item to a collection using DELETE /v1/collections/:id/items/:itemId endpoint, where :id represents the unique identifier of the collection you want to update and itemId is the identifier of the item to remove from the collection.

Making a Node JS request with axios
const axios = require("axios");

axios
.request({
method: "delete",
maxBodyLength: Infinity,
url: "https://api.arttribute.io/v1/collections/:id/items/:itemId",
headers: {
Authorization: "Bearer eyJhbGciOiJIU...",
},
data: JSON.stringify(data),
})
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
caution

To successfully update a collection, the provided id must be owned by the user making the request. The user is determined by the Access token. If no token is provided, the user will be resolved to the user who generated the API Key provided. To learn how to make a delete request on behalf of another user, check how to generate user access tokens

Deleting a collection

If you wish to remove a collection from Arttribute, you can do so using the DELETE /v1/collections/:id endpoint. As with updates, you'll need the collection's unique ID for deletion. Be aware that deleting an item is an irreversible action, so use caution.

note

Auth required: Access token

Making a Node JS request with axios
const axios = require("axios");

axios
.request({
method: "delete",
maxBodyLength: Infinity,
url: "https://api.arttribute.io/v1/collections/:id", //TODO: Change to variable
headers: {
Authorization: "Bearer eyJhbGciO...",
},
})
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
caution

To successfully delete a collection, the provided ID must be owned by the user making the request. The user is determined by the Access token. If no token is provided, the user will be resolved to the user who generated the API Key provided. To learn how to make a delete request on behalf of another user, check how to generate user access tokens.