Skip to main content
PATCH
/
v1
/
content
/
{id}
curl -X PATCH https://api.raily.ai/v1/content/cnt_abc123xyz \
  -H "Authorization: Bearer raily_sk_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Updated: Introduction to AI",
    "policyId": "pol_enterprise",
    "metadata": {
      "featured": true,
      "lastReviewed": "2024-01-20"
    }
  }'
{
  "id": "cnt_abc123xyz",
  "object": "content",
  "externalId": "article-123",
  "title": "Updated: Introduction to AI",
  "type": "article",
  "source": "https://example.com/articles/ai-intro",
  "policyId": "pol_enterprise",
  "metadata": {
    "author": "Jane Smith",
    "category": "Technology",
    "publishedAt": "2024-01-15",
    "wordCount": 2500,
    "featured": true,
    "lastReviewed": "2024-01-20"
  },
  "status": "active",
  "created": "2024-01-15T10:30:00Z",
  "updated": "2024-01-20T14:00:00Z"
}

Path Parameters

id
string
required
The content ID (e.g., cnt_abc123) or external ID

Request Body

All fields are optional. Only provided fields will be updated.
title
string
Updated title
source
string
Updated source URL
policyId
string
New policy ID to apply
metadata
object
Updated metadata. Merges with existing metadata by default.
metadataReplace
boolean
default:"false"
If true, replaces all metadata instead of merging
tags
array
Updated tags array (replaces existing tags)
status
string
Content status: active or archived

Response

Returns the updated content object.
curl -X PATCH https://api.raily.ai/v1/content/cnt_abc123xyz \
  -H "Authorization: Bearer raily_sk_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Updated: Introduction to AI",
    "policyId": "pol_enterprise",
    "metadata": {
      "featured": true,
      "lastReviewed": "2024-01-20"
    }
  }'
{
  "id": "cnt_abc123xyz",
  "object": "content",
  "externalId": "article-123",
  "title": "Updated: Introduction to AI",
  "type": "article",
  "source": "https://example.com/articles/ai-intro",
  "policyId": "pol_enterprise",
  "metadata": {
    "author": "Jane Smith",
    "category": "Technology",
    "publishedAt": "2024-01-15",
    "wordCount": 2500,
    "featured": true,
    "lastReviewed": "2024-01-20"
  },
  "status": "active",
  "created": "2024-01-15T10:30:00Z",
  "updated": "2024-01-20T14:00:00Z"
}

Archive Content

To archive content (disable access while preserving data):
await raily.content.update('cnt_abc123xyz', {
  status: 'archived'
});

Upsert (Create or Update)

Use the upsert endpoint to create content if it doesn’t exist, or update if it does:
const content = await raily.content.upsert({
  externalId: 'article-123',
  title: 'Introduction to AI',
  type: 'article',
  source: 'https://example.com/articles/ai-intro'
});
// Creates if externalId doesn't exist, updates if it does