POST
/
api
/
export
curl --request POST \
  --url https://api.docswrite.com/api/export \
  --header 'Content-Type: application/json' \
  --data '{
  "google_docs_url": "https://docs.google.com/document/d/1aBcDeFg/edit",
  "title": "My Blog Post",
  "slug": "my-blog-post",
  "tags": "technology, wordpress, automation",
  "categories": "Technology, Tutorials",
  "state": "draft",
  "author": "John Doe",
  "date": "2024-04-01 09:00:00",
  "excerpt": "This is a brief description of the post content.",
  "post_type": "post",
  "featured_image_url": "https://example.com/image.jpg",
  "featured_image_alt_text": "Description of the featured image",
  "featured_image_caption": "Image caption text",
  "export_settings": {
    "compress_images": true,
    "demote_headings": false,
    "convert_to_webp": true,
    "first_image_as_featured_image": true,
    "add_no_follow_to_external_links": true,
    "bold_as_strong": false,
    "wp_content_editor": "classic"
  },
  "yoast_settings": {
    "yoast_focuskw": "wordpress automation",
    "yoast_metadesc": "Learn how to automate WordPress publishing with Docswrite",
    "yoast_title": "WordPress Automation Guide | My Site",
    "yoast_canonical": "https://example.com/wordpress-automation"
  },
  "rankmath_settings": {
    "rank_math_focus_keyword": "wordpress automation"
  },
  "newspack_settings": {
    "newspack_article_summary": "This article covers WordPress automation techniques",
    "newspack_article_summary_title": "WordPress Automation Summary",
    "newspack_post_subtitle": "A comprehensive guide to automation"
  }
}'
{
  "error": false,
  "message": "Post added to queue",
  "data": {
    "google_docs_url": "https://docs.google.com/document/d/1aBcDeFg/edit",
    "title": "My Blog Post",
    "jobId": "job-abc123"
  }
}

Additional Information

Best Practices

  1. Always share Google Docs with “Anyone with the link”
  2. Test with drafts first before publishing live content
  3. Use descriptive titles and slugs for better SEO
  4. Include alt text for images for accessibility
  5. Set appropriate categories and tags to organize content

Create WordPress Post

Create or update a blog post or page on your WordPress site from a Google Docs document.

POST https://api.docswrite.com/api/export?token=YOUR_TOKEN

Headers

HeaderValue
Content-Typeapplication/json

Request Body

The request body should contain the Google Docs URL and any additional parameters to customize the post.

Required Parameters

ParameterTypeDescription
google_docs_urlstringURL of the Google Doc. Must be shared with “anyone with link”

Optional Parameters

ParameterTypeDefaultDescription
titlestringGoogle Docs titlePost title
slugstringAuto-generatedCustom URL slug
tagsstring-Comma-separated list of tags
categoriesstring-Comma-separated list of categories
statestringdraftPost status: publish or draft
authorstringAPI token creatorAuthor username or full name
datestringCurrent timePublish date in YYYY-MM-DD HH:MM:SS format
excerptstring-Post excerpt for SEO
post_typestringpostType: post or page
featured_image_urlstring-URL of featured image
featured_image_alt_textstring-Alt text for featured image
featured_image_captionstring-Caption for featured image

Export Settings

Control how your content is processed:

ParameterTypeDefaultDescription
export_settings.compress_imagesbooleantrueCompress images before upload
export_settings.demote_headingsbooleanfalseDemote headings by one level
export_settings.convert_to_webpbooleantrueConvert images to WebP format
export_settings.first_image_as_featured_imagebooleantrueSet first image as featured image
export_settings.add_no_follow_to_external_linksbooleantrueAdd nofollow to external links
export_settings.bold_as_strongbooleanfalseConvert bold text to strong tag
export_settings.wp_content_editorstringclassicContent editor: classic or gutenberg_editor

SEO Plugin Settings

Yoast SEO Settings

ParameterTypeDescription
yoast_settings.yoast_focuskwstringFocus keyword
yoast_settings.yoast_metadescstringMeta description
yoast_settings.yoast_titlestringSEO title
yoast_settings.yoast_canonicalstringCanonical URL

RankMath Settings

ParameterTypeDescription
rankmath_settings.rank_math_focus_keywordstringFocus keyword

Newspack Settings

ParameterTypeDescription
newspack_settings.newspack_article_summarystringArticle summary
newspack_settings.newspack_article_summary_titlestringSummary title
newspack_settings.newspack_post_subtitlestringPost subtitle

Advanced Custom Fields (ACF)

ParameterTypeDescription
acf_field_namestringCustom field value (supports URLs for images)

Example Requests

Basic Request

{
  "google_docs_url": "https://docs.google.com/document/d/1aBcDeFg/edit?usp=sharing",
  "title": "My Blog Post",
  "state": "publish",
  "categories": "Technology, WordPress",
  "tags": "automation, publishing"
}

Complete Request with All Options

{
  "google_docs_url": "https://docs.google.com/document/d/1aBcDeFgHiJkLmNopQrStUvWxYz/edit?usp=sharing",
  "title": "Complete Example Blog Post",
  "slug": "complete-example-blog-post",
  "tags": "example, blog post, complete",
  "categories": "Technology, Tutorials",
  "state": "draft",
  "author": "Jane Doe",
  "date": "2024-04-01 09:00:00",
  "excerpt": "This is a comprehensive example of all available parameters.",
  "post_type": "post",
  "featured_image_url": "https://images.unsplash.com/photo-1662572091420-95992f339784",
  "featured_image_alt_text": "Complete Example Featured Image",
  "featured_image_caption": "Example caption for the featured image",
  "export_settings": {
    "compress_images": true,
    "demote_headings": false,
    "convert_to_webp": true,
    "first_image_as_featured_image": true,
    "add_no_follow_to_external_links": true,
    "bold_as_strong": false,
    "wp_content_editor": "classic"
  },
  "newspack_settings": {
    "newspack_article_summary": "This is an example article summary for Newspack themes.",
    "newspack_article_summary_title": "Example Summary Title",
    "newspack_post_subtitle": "Example Post Subtitle"
  },
  "yoast_settings": {
    "yoast_focuskw": "example blog post",
    "yoast_metadesc": "This is a comprehensive example meta description for SEO.",
    "yoast_title": "Complete Example Blog Post | My Site"
  },
  "rankmath_settings": {
    "rank_math_focus_keyword": "example blog post"
  }
}

Scheduled Post Request

{
  "google_docs_url": "https://docs.google.com/document/d/1aBcDeFg/edit",
  "title": "Scheduled Blog Post",
  "state": "publish",
  "date": "2024-12-25 10:00:00",
  "categories": "Holiday, Special"
}

Response Examples

Success Response (200 OK)

{
  "error": false,
  "message": "Post added to queue",
  "data": {
    "google_docs_url": "https://docs.google.com/document/d/1aBcDeFg/edit",
    "title": "My Blog Post",
    "jobId": "job-abc123"
  }
}

Error Responses

Bad Request (400)

{
  "error": true,
  "message": "Invalid Google Docs URL",
  "details": "The provided URL is not accessible or not shared properly"
}

Unauthorized (401)

{
  "error": true,
  "message": "Invalid API token",
  "details": "Please check your API token and try again"
}

Rate Limited (429)

{
  "error": true,
  "message": "Rate limit exceeded",
  "details": "You've exceeded the rate limit. Please wait before making more requests."
}

cURL Examples

Basic cURL Request

curl -X POST 'https://api.docswrite.com/api/export?token=YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "google_docs_url": "https://docs.google.com/document/d/1aBcDeFg/edit",
    "title": "My Blog Post",
    "state": "publish",
    "categories": "Technology, WordPress",
    "tags": "automation, publishing"
  }'

Advanced cURL Request with SEO

curl -X POST 'https://api.docswrite.com/api/export?token=YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "google_docs_url": "https://docs.google.com/document/d/1aBcDeFg/edit",
    "title": "SEO Optimized Post",
    "state": "publish",
    "yoast_settings": {
      "yoast_focuskw": "SEO optimization",
      "yoast_metadesc": "Learn how to optimize your content for search engines"
    },
    "export_settings": {
      "compress_images": true,
      "convert_to_webp": true
    }
  }'

Authorizations

token
string
query
required

API token obtained from Docswrite dashboard

Query Parameters

token
string
required

Your personal API token

Body

application/json

Post creation parameters

The body is of type object.

Response

200
application/json

Post creation initiated successfully

The response is of type object.