Content Pieces
Content pieces store all the content and related metadata that you create. With the API you can both retrieve and manage content pieces, including their variants and content groups they’re a part of.
Content of individual pieces is represented in a JSON tree format, described in detail in a separate section.
Retrieve Content Piece
Retrieves details of the content piece specified by ID. You can specify additional options to retrieve specific variant of the content piece, change return format of the description and specify whether the content should be included in the response.
ID of the content piece
Whether to fetch the JSON content
ID or key of the variant
Format of the description
htmltext
ID of the content piece
ISO-formatted date metadata of the content piece
Title of the content piece
Description of the content piece
URL of the cover image
Alt text of the cover image
ID of the content group the piece is directly assigned to
Custom JSON data of the content piece
Canonical link of the content piece
Slug of the content piece
Filename of the content piece
ID of the workspace member
ID of the user
URL of the user's profile image
Short username
User's full name
Email address
ID of the tag
Label assigned to the tag
Color assigned to the tag
grayredpinkorangeamberpurpleindigobluecyangreenteallimefuchsiaemerald
Width of the cover image
JSON content of the piece
curl --request GET \
--url "https://api.vrite.io/content-pieces?id={ID}" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
const client = createClient({
token: "<API_TOKEN>",
});
const result = await client.contentPieces.get({
id: "cc6b3be85cb621fcca0568dd",
// Optional
content: true,
// Optional
variant: "bf75ef612ccfdccb6e2d1fce",
// Optional
description: "text",
});
{
"id": "cc6b3be85cb621fcca0568dd",
"date": "string",
"title": "string",
"description": "string",
"coverUrl": "string",
"coverAlt": "string",
"contentGroupId": "4a199daf7db303be195b8b86",
"customData": "string",
"canonicalLink": "string",
"slug": "string",
"filename": "string",
"members": [
{
"id": "2d9eee214c97fe6849fab054",
"profile": {
"id": "fb4ccf50f9abc1699ef1ab13",
"avatar": "string",
"username": "string",
"fullName": "string",
"email": "[email protected]"
}
}
],
"tags": [
{
"id": "330feb385dda6ed62c663771",
"label": "string",
"color": "gray"
}
],
"coverWidth": "string",
"content": {
...
}
}
List Content Pieces
List content pieces assigned to the content group specified by ID. Supports pagination and filtering by slug or tag ID.
Whether to fetch the JSON content
Comma-separated list of IDs of the content groups which contain the content pieces
ID or key of the variant
Slug of the content piece
ID of the tag
Last order identifier to start fetching content pieces from
Number of content pieces per page
Page number to fetch
ID of the content piece
ISO-formatted date metadata of the content piece
Title of the content piece
Description of the content piece
URL of the cover image
Alt text of the cover image
ID of the content group the piece is directly assigned to
Custom JSON data of the content piece
Canonical link of the content piece
Slug of the content piece
Filename of the content piece
ID of the workspace member
ID of the user
URL of the user's profile image
Short username
User's full name
Email address
ID of the tag
Label assigned to the tag
Color assigned to the tag
grayredpinkorangeamberpurpleindigobluecyangreenteallimefuchsiaemerald
Width of the cover image
JSON content of the piece
curl --request GET \
--url "https://api.vrite.io/content-pieces/list" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
const client = createClient({
token: "<API_TOKEN>",
});
const result = await client.contentPieces.list({
contentGroupId: "283cb91a14c716723edeb5f8",
// Optional
tagId: "48abb9ca53ee563e8ff35d31",
// Optional
slug: "blog/post",
// Optional
variant: "bf75ef612ccfdccb6e2d1fce",
// Optional
page: 1,
// Optional
perPage: 20,
});
[
{
"id": "db32b898d884369e2c1d5a8b",
"date": "string",
"title": "string",
"description": "string",
"coverUrl": "string",
"coverAlt": "string",
"contentGroupId": "283cb91a14c716723edeb5f8",
"customData": "string",
"canonicalLink": "string",
"slug": "string",
"filename": "string",
"members": [
{
"id": "ce82b0a9173a1391c70a2b81",
"profile": {
"id": "6aa12008ec1c1478ca8233ae",
"avatar": "string",
"username": "string",
"fullName": "string",
"email": "[email protected]"
}
}
],
"tags": [
{
"id": "48abb9ca53ee563e8ff35d31",
"label": "string",
"color": "gray"
}
],
"order": "string"
}
]
Create Content Piece
Creates a content piece from the provided data and assigns it to the specified content group.
ISO-formatted date metadata of the content piece
Title of the content piece
Description of the content piece
IDs of the tags assigned to the content piece
URL of the cover image
Alt text of the cover image
ID of the content group the piece is directly assigned to
Custom JSON data of the content piece
Canonical link of the content piece
Filename of the content piece
IDs of the workspace members assigned to the content piece
HTML content
ID of the reference content piece to order the content piece after
Slug of the content piece
curl --request POST \
--url "https://api.vrite.io/content-pieces" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"title": "{TITLE}",
"tags": "{TAGS}",
"contentGroupId": "{CONTENTGROUPID}",
"members": "{MEMBERS}"
}'
const client = createClient({
token: "<API_TOKEN>",
});
const result = await client.contentPieces.create({
title: "string",
tags: ["513e845e5e6d9e92ba71fc82"],
members: ["f1fd9a8268efd4d673ae04cc"],
slug: "string",
contentGroupId: "6c7ea0927b79efa9bb616820",
// Optional
date: "2024-02-23T14:34:14.099Z",
// Optional
description: "string",
// Optional
coverUrl: "string",
// Optional
coverAlt: "string",
// Optional
customData: "string",
// Optional
canonicalLink: "string",
// Optional
filename: "string",
// Optional
content: "string",
// Optional
referenceId: "7ee53ccbbb26195d90838cc1",
});
{
"id": "743b0098a83ee6ee0980736d"
}
Update Content Piece
Updates a content piece (or specified variant) matched by ID, using the provided data. If a new content group is specified the piece will be reassigned to it.
ID of the content piece
ISO-formatted date metadata of the content piece
Title of the content piece
Description of the content piece
IDs of the tags assigned to the content piece
URL of the cover image
Alt text of the cover image
ID of the content group the piece is directly assigned to
Custom JSON data of the content piece
Canonical link of the content piece
Slug of the content piece
Filename of the content piece
IDs of the workspace members assigned to the content piece
Width of the cover image
HTML content
ID or key of the variant to update
curl --request PUT \
--url "https://api.vrite.io/content-pieces" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"id": "{ID}"
}'
const client = createClient({
token: "<API_TOKEN>",
});
await client.contentPieces.update({
id: "2279e093a802d7167be0de",
// Optional
variant: "bf75ef612ccfdccb6e2d1fce",
// Optional
date: "2024-02-23T14:34:14.099Z",
// Optional
title: "string",
// Optional
description: "string",
// Optional
tags: ["be431a7d817127f4afd71d23"],
// Optional
coverUrl: "string",
// Optional
coverAlt: "string",
// Optional
contentGroupId: "279d80fcf27e88aecb5ca4fc",
// Optional
customData: "string",
// Optional
canonicalLink: "string",
// Optional
slug: "string",
// Optional
filename: "string",
// Optional
members: ["06d82fd3fc8c4642f2b85fd0"],
// Optional
coverWidth: "string",
// Optional
content: "<p></p>",
});
Delete Content Piece
Deletes the content piece specified by ID, together with all its variants.
ID of the content piece
curl --request DELETE \
--url "https://api.vrite.io/content-pieces?id={ID}" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
const client = createClient({
token: "<API_TOKEN>",
});
await client.contentPieces.delete({
id: "2279e093a802d7167be0de",
});