Skip to main content

Create Content

Add new content items to your catalog. Supports all content types: PDF, EPUB, audiobooks, physical products, and external links.


Endpoint

POST /api/v3/content

Request Body

Required Fields

FieldTypeDescription
namestringContent title (max 255 chars)
file_typestringContent type: pdf, epub, audio, physical
langstringISO 639-1 language code. See Supported Content Languages

Optional Fields

FieldTypeDescription
descriptionstringFull content description (HTML allowed)
published_atstringPublication date (YYYY-MM-DD only)
audiencestringTarget audience
subtitlestringContent subtitle (max 255 chars)
publication_placestringPlace of publication (max 255 chars)
edition_yearintegerEdition year (4 digits, e.g., 2025)

Identifiers

FieldTypeDescription
identifiersarrayArray of identifier objects (max 20)
identifiers[].typestringIdentifier type: isbn_digital, isbn_printed, uuid, ddc, external_id
identifiers[].valuestringIdentifier value (max 255 chars). Validated per type (e.g., ISBN-13 checksum)
identifiers[].is_primarybooleanMark as primary identifier (optional, defaults to false)
Primary Identifier

The primary identifier's value is automatically synced to the external_id field for backward compatibility. If no identifier is marked as primary, the first one in the array is auto-promoted. Only one identifier can be marked as primary.

Types isbn_digital, isbn_printed, uuid, and external_id require tenant-level uniqueness — two content items cannot share the same identifier of these types. The ddc type does not require uniqueness.

File Upload (digital content only)

FieldTypeDescription
filestringStorage path to uploaded file (mutually exclusive with file_url)
file_urlstringExternal URL to download file from (mutually exclusive with file)
coverstringStorage path to uploaded cover image (mutually exclusive with cover_url)
cover_urlstringExternal URL for cover image (mutually exclusive with cover)
File Upload Options
  • file_url / cover_url: Provide a publicly accessible URL. The platform will download the file automatically.
  • file / cover: Provide a storage path from SFTP upload. Contact support to enable SFTP access for your account.
File Processing

Files are processed asynchronously. The content is created immediately with conversion_status: awaiting. Use Get Content to poll for processing completion.

Pricing

FieldTypeDescription
pricesarrayPrice array: [{currency_id, amount}]
Scheduled Pricing

Prices support starts_at and ends_at fields for scheduled pricing: [{currency_id, amount, starts_at, ends_at}]. Dates should be in YYYY-MM-DD format.

Access Settings

FieldTypeDescription
freebooleanEnable free access
free_untilstringFree access expiration (YYYY-MM-DD)
require_loginbooleanRequire login for free access
previewbooleanEnable content preview
preview_require_loginbooleanRequire login for preview

Marketplace

FieldTypeDescription
show_in_marketplacebooleanMake content available in the Publica.la marketplace. When true, the content is listed for other tenants to discover and add to their stores. Defaults to false if not provided.

Metadata

FieldTypeDescription
authorarrayAuthor names (max 200 chars each)
publisherarrayPublisher names (max 200 chars each)
keywordsarrayKeywords/tags (max 200 chars each)
bisacarrayBISAC codes: [{code: "FIC000000"}] (max 4 codes)
categoryarrayCategory names (max 200 chars each)
collectionarrayCollection names (max 200 chars each)
countryarrayCountry names (max 200 chars each)
editionarrayEdition names (max 200 chars each)
narratorarrayNarrator names for audiobooks (max 200 chars each)
publishing_grouparrayPublishing group names (max 200 chars each)
custom_metadataobjectCustom taxonomy groups: {"group_slug": ["value1", "value2"]}
share_with_tenants_idsarrayTenant IDs (strings) to share this content with. See Content Sharing
format_group_idsarrayFormat group IDs (strings) to associate this content with

Geographic Restrictions

FieldTypeDescription
geographic_restrictionsobject{included: [...], excluded: [...]}

Physical Product Fields

FieldTypeDescription
binding_typestringBinding type (hardcover, paperback, etc.)
pagesintegerNumber of pages (min: 0)
heightfloatHeight in cm (min: 0)
widthfloatWidth in cm (min: 0)
weightfloatWeight in grams (min: 0)
stockbooleanIn stock status
editing_locationstringEditing/printing location
thicknessfloatThickness in cm (min: 0)

Request Examples

Basic PDF Content

curl -X POST "https://yourstore.publica.la/api/v3/content" \
-H "X-User-Token: your-api-token" \
-H "Content-Type: application/json" \
-d '{
"name": "Introduction to Machine Learning",
"file_type": "pdf",
"lang": "en",
"file_url": "https://example.com/files/ml-intro.pdf",
"identifiers": [
{ "type": "isbn_digital", "value": "978-1-234-56789-0", "is_primary": true }
]
}'

EPUB with Full Metadata

curl -X POST "https://yourstore.publica.la/api/v3/content" \
-H "X-User-Token: your-api-token" \
-H "Content-Type: application/json" \
-d '{
"name": "The Complete Guide to Digital Publishing",
"file_type": "epub",
"lang": "en",
"description": "<p>A comprehensive guide to digital publishing...</p>",
"published_at": "2025-01-15",
"file_url": "https://example.com/files/publishing-guide.epub",
"cover_url": "https://example.com/covers/publishing-guide.jpg",
"prices": [
{ "currency_id": "USD", "amount": 19.99 },
{ "currency_id": "EUR", "amount": 17.99 }
],
"author": ["Jane Smith", "John Doe"],
"publisher": ["Tech Publishing House"],
"keywords": ["publishing", "digital", "ebooks"],
"bisac": [
{ "code": "COM000000" }
],
"identifiers": [
{ "type": "isbn_digital", "value": "978-0-987-65432-1", "is_primary": true }
]
}'

Content with Multiple Identifiers

curl -X POST "https://yourstore.publica.la/api/v3/content" \
-H "X-User-Token: your-api-token" \
-H "Content-Type: application/json" \
-d '{
"name": "Advanced Data Structures",
"file_type": "epub",
"lang": "en",
"file_url": "https://example.com/files/data-structures.epub",
"identifiers": [
{ "type": "isbn_digital", "value": "978-0-306-40615-7", "is_primary": true },
{ "type": "ddc", "value": "005.73" }
]
}'

Free Content with Expiration

curl -X POST "https://yourstore.publica.la/api/v3/content" \
-H "X-User-Token: your-api-token" \
-H "Content-Type: application/json" \
-d '{
"name": "Sample Chapter - Preview Edition",
"file_type": "pdf",
"lang": "en",
"file_url": "https://example.com/samples/chapter1.pdf",
"free": true,
"free_until": "2025-06-30",
"require_login": true
}'

Audiobook

curl -X POST "https://yourstore.publica.la/api/v3/content" \
-H "X-User-Token: your-api-token" \
-H "Content-Type: application/json" \
-d '{
"name": "Mystery Novel - Narrated Edition",
"file_type": "audio",
"lang": "en",
"description": "Award-winning mystery novel, professionally narrated",
"prices": [
{ "currency_id": "USD", "amount": 14.99 }
],
"author": ["Mystery Author"],
"publisher": ["Audiobook Productions"]
}'
Audiobook Tracks

After creating an audiobook, use the Audiobook Tracks API to add individual audio tracks.

Physical Product

curl -X POST "https://yourstore.publica.la/api/v3/content" \
-H "X-User-Token: your-api-token" \
-H "Content-Type: application/json" \
-d '{
"name": "Collector Edition Hardcover",
"file_type": "physical",
"lang": "en",
"cover_url": "https://example.com/covers/collector.jpg",
"prices": [
{ "currency_id": "USD", "amount": 49.99 }
],
"binding_type": "hardcover",
"pages": 450,
"height": 24.5,
"width": 16.0,
"weight": 650,
"stock": true
}'

Content with Geographic Restrictions

curl -X POST "https://yourstore.publica.la/api/v3/content" \
-H "X-User-Token: your-api-token" \
-H "Content-Type: application/json" \
-d '{
"name": "Regional Edition",
"file_type": "epub",
"lang": "es",
"file_url": "https://example.com/files/regional.epub",
"prices": [
{ "currency_id": "USD", "amount": 9.99 }
],
"geographic_restrictions": {
"included": ["AR", "CL", "UY", "MX"],
"excluded": []
}
}'

Response

Success Response (201 Created)

{
"data": {
"id": "468170",
"external_id": "978-1-234-56789-0",
"name": "Introduction to Machine Learning",
"slug": "introduction-to-machine-learning",
"lang": "en",
"file_type": "pdf",
"audience": null,
"subtitle": null,
"publication_place": null,
"edition_year": null,
"cover_url": null,
"reader_url": "https://yourstore.publica.la/reader/introduction-to-machine-learning",
"product_url": "https://yourstore.publica.la/library/publication/introduction-to-machine-learning",
"created_at": "2025-12-23T10:30:00.000000Z",
"updated_at": "2025-12-23T10:30:00.000000Z",
"published_at": "2025-12-23T00:00:00.000000Z",
"license": "retail",
"free": {
"enabled": false,
"until": null,
"require_login": false
},
"preview": {
"enabled": false,
"require_login": false
},
"conversion_status": "awaiting",
"prices": [],
"description": null,
"publisher": [],
"author": [],
"bisac": [],
"keywords": [],
"country": [],
"edition": [],
"narrator": [],
"publishing_group": [],
"thema": [],
"series": [],
"category": [],
"collection": [],
"metrics": {
"total_pages": 0,
"total_words": 0,
"total_seconds": 0
},
"custom_metadata": {},
"geographic_restrictions": null,
"identifiers": [
{
"type": "isbn_digital",
"value": "978-1-234-56789-0",
"is_primary": true
}
]
}
}
Always Included

The create response always includes prices, description, metadata, geographic_restrictions, and identifiers data regardless of the include parameter.


Conversion Status

Digital content undergoes asynchronous processing. Track the status via the conversion_status field returned in the content response.

StatusDescription
awaiting_*Content is queued or waiting for processing to begin
started_*Processing in progress (varies by file type)
doneProcessing complete, content available
deferredAwaiting first user access to trigger processing (bulk imports)
error_*Processing failed (varies by file type)
Intermediate statuses may change

Do not couple your logic to specific intermediate status values (awaiting_*, started_*, error_*) as they may change without notice. If you need to check whether content is ready, use done as the only stable status to rely on.

Polling for Completion

curl -X GET "https://yourstore.publica.la/api/v3/content/468170" \
-H "X-User-Token: your-api-token"

Error Handling

Validation Errors (422)

{
"message": "The given data was invalid.",
"errors": {
"name": ["The name field is required."],
"file_type": ["The selected file type is invalid."]
}
}

Duplicate Identifier (422)

{
"message": "The given data was invalid.",
"errors": {
"identifiers.0.value": [
"This isbn_digital identifier is already in use as primary for another content."
]
}
}

File Processing Error (422)

{
"message": "The given data was invalid.",
"errors": {
"file_url": ["Unable to download file from the provided URL."]
}
}

Authentication Error (401)

{
"message": "Unauthenticated."
}

Common Validation Rules

FieldRules
nameRequired, max 255 chars
file_typeRequired, one of: pdf, epub, audio, physical
langRequired, valid language code
subtitleOptional, max 255 chars
publication_placeOptional, max 255 chars
edition_yearOptional, 4 digits
descriptionOptional, max 20,000 chars, HTML allowed
prices[].currency_idValid ISO 4217 currency code
prices[].amountNumber, min: 0 (zero allowed for free pricing)
file_urlValid URL, accessible for download
published_atValid date (YYYY-MM-DD only)
bisac[].codeValid BISAC code
geographic_restrictions.includedArray of ISO 3166-1 alpha-2 country codes
geographic_restrictions.excludedArray of ISO 3166-1 alpha-2 country codes
identifiersOptional, array, max 20 items
identifiers[].typeRequired, one of: isbn_digital, isbn_printed, uuid, ddc, external_id
identifiers[].valueRequired, max 255 chars. Validated per type (ISBN-10/ISBN-13 checksum, UUID format, DDC format)
identifiers[].is_primaryOptional, boolean

Best Practices

  1. Use identifiers - Always set identifiers (ISBN, UUID, etc.) for cross-system synchronization
  2. Poll for completion - Check conversion_status before assuming content is available
  3. Include complete metadata - Better discoverability with author, publisher, and BISAC codes
  4. Set prices upfront - Configure pricing at creation to avoid separate update calls

See Also


X

Graph View