Draft2Live API
Generate, manage, and publish AI-powered content programmatically. Integrate Draft2Live into your workflows with our REST API.
Overview
The Draft2Live API allows you to generate, manage, and publish AI-powered content programmatically. Build custom integrations, automate content workflows, and manage your articles from any platform.
Base URL
https://draft2live.ai/api/v1/publicResponse Format
All successful responses are wrapped in a {"data": {...}} envelope. Lists include pagination metadata.
// Standard response envelope
{
"data": {
"id": 1234,
"title": "Your article title",
"status": "draft"
}
}
// List response with pagination
{
"data": [
{ "id": 1, "title": "Article 1" },
{ "id": 2, "title": "Article 2" }
],
"meta": {
"page": 1,
"per_page": 20,
"total": 47,
"total_pages": 3
}
}Authentication
Authenticate your API requests using an API key. You can create and manage API keys from your Account → API Keys page.
Keep your API keys secure
Do not share your API key in publicly accessible areas such as client-side code, GitHub, or public forums. Use environment variables on your server.
API Key (recommended)
Pass your API key via the X-API-Key header.
curl -X GET "https://draft2live.ai/api/v1/public/articles" \
-H "X-API-Key: d2l_your_key_here" \
-H "Content-Type: application/json"Bearer Token
JWT bearer tokens are also supported for session-based authentication.
curl -X GET "https://draft2live.ai/api/v1/public/articles" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json"Articles
Manage your generated articles. Retrieve, list, and filter your content library.
/articlesRetrieve a paginated list of your articles. Supports filtering by status and language.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| page | integer | Page number (default: 1) |
| per_page | integer | Items per page, max 100 (default: 20) |
| status | string | Filter by status: draft, published, archived |
| language | string | Filter by language code (e.g., uk, en, de) |
Response
{
"data": [
{
"id": 4821,
"title": "10 SEO-порад для просування інтернет-магазину",
"slug": "10-seo-porad-dlia-prosuvannia-internet-mahazyny",
"status": "published",
"language": "uk",
"word_count": 2450,
"model": "gpt-4o",
"created_at": "2026-04-15T10:23:00Z",
"updated_at": "2026-04-15T12:05:30Z"
},
{
"id": 4820,
"title": "How to Build a Content Strategy in 2026",
"slug": "how-to-build-content-strategy-2026",
"status": "draft",
"language": "en",
"word_count": 1800,
"model": "claude-sonnet",
"created_at": "2026-04-14T08:15:00Z",
"updated_at": "2026-04-14T08:15:00Z"
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 142,
"total_pages": 8
}
}/articles/{id}Retrieve full details of a single article including its HTML content.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | integer | The article ID |
Response
{
"data": {
"id": 4821,
"title": "10 SEO-порад для просування інтернет-магазину",
"slug": "10-seo-porad-dlia-prosuvannia-internet-mahazyny",
"status": "published",
"language": "uk",
"word_count": 2450,
"model": "gpt-4o",
"content": "<h2>Вступ</h2><p>Просування інтернет-магазину...</p>",
"meta_title": "10 SEO-порад для інтернет-магазину | 2026",
"meta_description": "Дізнайтеся про найефективніші SEO-стратегії...",
"keywords": ["seo", "інтернет-магазин", "просування"],
"created_at": "2026-04-15T10:23:00Z",
"updated_at": "2026-04-15T12:05:30Z",
"publications": [
{
"site_id": 12,
"site_name": "My WordPress Blog",
"published_at": "2026-04-15T12:05:30Z",
"external_url": "https://myblog.com/10-seo-porad"
}
]
}
}Generation
Generate new articles using AI. Article generation is asynchronous -- submit a job and poll for completion.
/articles/generateStart a new article generation job. Returns a job ID for tracking progress.
Request Body
| Parameter | Type | Description |
|---|---|---|
| topic | string | The article topic or title |
| language_code | string | Target language (e.g., uk, en, de, fr) |
| word_count | integer | Target word count (default: 1500) |
| model | string | AI model: gpt-4o, claude-sonnet, gemini-pro (default: gpt-4o) |
| keywords | string[] | SEO keywords to include in the article |
| custom_instructions | string | Additional instructions for the AI writer |
Request Example
curl -X POST "https://draft2live.ai/api/v1/public/articles/generate" \
-H "X-API-Key: d2l_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"topic": "Як обрати CMS для інтернет-магазину у 2026 році",
"language_code": "uk",
"word_count": 2000,
"model": "gpt-4o",
"keywords": ["CMS", "інтернет-магазин", "WordPress", "Drupal"],
"custom_instructions": "Focus on e-commerce features and SEO capabilities"
}'Response
{
"data": {
"job_id": "gen_a1b2c3d4e5f6",
"status": "pending",
"estimated_seconds": 45,
"created_at": "2026-04-15T14:30:00Z"
}
}/articles/jobs/{job_id}Check the status of a generation job. Poll this endpoint until status is 'completed' or 'failed'.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| job_id | string | The generation job ID returned from the generate endpoint |
Response (in progress)
{
"data": {
"job_id": "gen_a1b2c3d4e5f6",
"status": "in_progress",
"progress": 65,
"article_id": null
}
}Response (completed)
{
"data": {
"job_id": "gen_a1b2c3d4e5f6",
"status": "completed",
"progress": 100,
"article_id": 4822,
"completed_at": "2026-04-15T14:30:48Z"
}
}Response (failed)
{
"data": {
"job_id": "gen_a1b2c3d4e5f6",
"status": "failed",
"progress": 0,
"article_id": null,
"error": "Insufficient credits to complete generation"
}
}Images
Generate AI images using multiple models (Flux, GPT Image, Gemini) with style presets and auto-prompt enhancement. Requires the ai_image_generation feature on your plan.
/images/generateGenerate an AI image and save it to your media library.
Request body
| Parameter | Type | Description |
|---|---|---|
| prompt | string | Image description (3-1000 chars) |
| aspect_ratio | string | 1:1, 16:9, 9:16, 4:3, 3:4 (default: 1:1) |
| model | string | auto, flux-flex, flux-pro, flux-max, gpt-image, gemini (default: auto) |
| style | string | realistic, cartoon, watercolor, oil-painting, 3d-render, anime, sketch, pop-art, pixel-art, cyberpunk |
| auto_prompt | boolean | Auto-enhance prompt with AI (default: true) |
| folder_id | integer | Folder ID to save image to |
Example request
curl -X POST https://draft2live.ai/api/v1/public/images/generate \
-H "X-API-Key: d2l_your_key" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Modern office building at sunset, glass facade reflecting orange sky",
"aspect_ratio": "16:9",
"model": "flux-pro",
"style": "realistic"
}'Response
{
"data": {
"id": 142,
"url": "/uploads/users/4/media/2026/04/modern-office-building.png",
"filename": "modern-office-building.png",
"width": 1344,
"height": 768,
"cost_usd": 0.04,
"model_used": null
}
}/images/modelsList available image generation models with cost estimates.
Response
{
"data": {
"models": [
{
"key": "flux-klein",
"name": "Flux Klein",
"cost_estimate": 0.014
},
{
"key": "flux-flex",
"name": "Flux Flex",
"cost_estimate": 0.025
},
{
"key": "flux-pro",
"name": "Flux Pro",
"cost_estimate": 0.04
},
{
"key": "flux-max",
"name": "Flux Max",
"cost_estimate": 0.08
},
{
"key": "gpt-image",
"name": "GPT Image",
"cost_estimate": 0.04
},
{
"key": "gemini",
"name": "Gemini Image",
"cost_estimate": 0.04
}
]
}
}Sites
Manage your connected CMS sites (WordPress, Drupal). Sites are configured in the dashboard and referenced by ID when publishing.
/sitesList all CMS sites connected to your account.
Response
{
"data": [
{
"id": 12,
"name": "My WordPress Blog",
"type": "wordpress",
"url": "https://myblog.com",
"status": "connected",
"last_sync_at": "2026-04-15T09:00:00Z"
},
{
"id": 15,
"name": "Corporate Drupal Site",
"type": "drupal",
"url": "https://corporate.example.com",
"status": "connected",
"last_sync_at": "2026-04-14T18:30:00Z"
}
]
}Publishing
Publish generated articles to your connected CMS sites. Supports WordPress and Drupal with category assignment and publish status control.
/articles/{id}/publishPublish an article to a connected CMS site.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | integer | The article ID to publish |
Request Body
| Parameter | Type | Description |
|---|---|---|
| site_id | integer | Target CMS site ID |
| publish_status | string | CMS post status: publish, draft, pending (default: draft) |
| categories | integer[] | Array of CMS category IDs |
Request Example
curl -X POST "https://draft2live.ai/api/v1/public/articles/4821/publish" \
-H "X-API-Key: d2l_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"site_id": 12,
"publish_status": "draft",
"categories": [5, 12]
}'Response
{
"data": {
"publication_id": 891,
"article_id": 4821,
"site_id": 12,
"site_name": "My WordPress Blog",
"external_id": 3456,
"external_url": "https://myblog.com/?p=3456",
"status": "draft",
"published_at": "2026-04-15T14:45:00Z"
}
}/articles/{id}/publicationsList all publications (CMS posts) created from a specific article.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
| id | integer | The article ID |
Response
{
"data": [
{
"publication_id": 891,
"site_id": 12,
"site_name": "My WordPress Blog",
"site_type": "wordpress",
"external_id": 3456,
"external_url": "https://myblog.com/10-seo-porad",
"status": "published",
"published_at": "2026-04-15T14:45:00Z"
}
]
}Usage
Check your account credit balance and usage statistics.
/usage/creditsGet your current credit balance and usage for the current billing period.
Response
{
"data": {
"plan": "pro",
"credits_remaining": 847,
"credits_total": 1000,
"credits_used": 153,
"billing_period_start": "2026-04-01T00:00:00Z",
"billing_period_end": "2026-04-30T23:59:59Z",
"generations_this_period": 42
}
}Errors
The API uses standard HTTP status codes. Errors return a consistent JSON body with an error field.
{
"error": {
"code": "insufficient_credits",
"message": "You do not have enough credits to complete this request.",
"status": 402
}
}| Status | Code | Description |
|---|---|---|
| 401 | unauthorized | Invalid or missing API key |
| 402 | insufficient_credits | Not enough credits to complete the request |
| 403 | forbidden | Feature not available on your current plan |
| 404 | not_found | The requested resource does not exist |
| 422 | validation_error | Invalid request body or parameters |
| 500 | internal_error | An unexpected error occurred on our end |
Need help? Contact us at support@draft2live.ai or visit the dashboard.