WordPress publishing API
Install the AuthorityWriter Publisher plugin on your WordPress website, generate a secret key, and publish or update posts from AuthorityWriter.
https://your-wordpress-site.exampleSetup
- Download and install the AuthorityWriter Publisher plugin.
- Activate the plugin in WordPress.
- Open WordPress Admin → Settings → AuthorityWriter.
- Generate or copy the secret API key.
- Save the WordPress site URL and key in AuthorityWriter Website Settings.
Keep the key private. Send it only through the HTTPS header shown below.
Authentication
Every request requires this header:
X-AuthorityWriter-Key: aw_live_your_secret_keyMissing keys return 401. Incorrect keys return 403.
Connection ping
/wp-json/authoritywriter/v1/pingUse this endpoint to verify the plugin, WordPress site, and API key before publishing.
curl -X GET "https://your-wordpress-site.example/wp-json/authoritywriter/v1/ping" \
-H "X-AuthorityWriter-Key: aw_live_your_secret_key" \
-H "Accept: application/json"{
"status": "success",
"site_name": "Example Website",
"site_url": "https://your-wordpress-site.example",
"wp_version": "6.6.1"
}Publish or update a post
/wp-json/authoritywriter/v1/publish-postCreates a post or updates an existing post with the same slug. Use draft while testing.
curl -X POST "https://your-wordpress-site.example/wp-json/authoritywriter/v1/publish-post" \
-H "X-AuthorityWriter-Key: aw_live_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"title": "How to Choose Running Shoes for Flat Feet",
"content": "<p>Helpful article HTML goes here.</p>",
"slug": "running-shoes-for-flat-feet",
"status": "draft",
"focus_keyword": "running shoes for flat feet",
"meta_description": "Learn how to choose comfortable running shoes for flat feet.",
"featured_image": "https://cdn.example.com/shoes.jpg",
"featured_image_alt": "Running shoes selected for flat feet",
"category": "Running Gear",
"sub_category": "Buying Guides",
"categories": [12, 18],
"json_ld_schema": "{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\"}"
}'Fields
| Field | Type | Required | Details |
|---|---|---|---|
| title | string | Yes | Post title. |
| content | string | Yes | HTML; sanitized by WordPress. |
| slug | string | No | Defaults from title; same slug updates the post. |
| status | enum | No | draft, publish, or pending. Default: draft. |
| focus_keyword | string | No | Saved for Yoast and Rank Math. |
| meta_description | string | No | Saved for Yoast and Rank Math. |
| featured_image | URL/data URL | No | Imported into the Media Library. |
| featured_image_alt | string | No | Accessible image alt text. |
| json_ld_schema | JSON string | No | Stored and printed as JSON-LD. |
| category/sub_category | string | No | Category names. |
| categories | integer[] | No | WordPress IDs; takes precedence over names. |
Response fields
categories contains the final assigned WordPress category names. featured_image_result reports featured-image import success or warning. inline_images_result.imported lists each in-article source URL, local Media Library URL, and attachment ID. inline_images_result.warnings lists non-fatal inline-image import failures.
Success response
{
"status": "success",
"post_id": 428,
"post_url": "https://your-wordpress-site.example/running-shoes-for-flat-feet/",
"post_status": "draft",
"categories": ["Running Gear", "Buying Guides"],
"featured_image_result": "attached (media id 991)",
"inline_images_result": {
"imported": [
{
"source_url": "https://authoritywriter.com/storage/article-images/inline.jpg",
"local_url": "https://your-wordpress-site.example/wp-content/uploads/2026/09/aw-inline-428-1234.jpg",
"attachment_id": 992
}
],
"warnings": []
}
}Category mapping
Send either category names or existing WordPress category IDs.
categoriestakes precedence when it contains IDs.- If
categoriesis omitted, the plugin resolves or creates the parentcategory. - If
sub_categoryis provided, the plugin resolves or creates it as a child of the parent category. - The success response returns the final category names in
categories.
"category": "Running Gear",
"sub_category": "Buying Guides",
"categories": [12, 18]Use either names or IDs according to your workflow; do not rely on both for conflicting taxonomies.
The featured_image request field accepts an HTTPS image URL or supported base64 data URL. The plugin imports it into the WordPress Media Library, sets it as the featured image, and saves featured_image_alt.
In-article images are also uploaded first: Before the final post update, the plugin finds each remote <img src="..."> inside content, downloads it, validates the actual image type, imports it into the WordPress Media Library, preserves its alt text, and rewrites the HTML src to the new local WordPress attachment URL. The image stays in its original section and position.
Original HTML:
<img src="https://authoritywriter.com/storage/article-images/inline.jpg" alt="Stability features">
After WordPress import:
<img src="https://your-wordpress-site.example/wp-content/uploads/2026/09/aw-inline-428-1234.jpg" alt="Stability features">The success response includes inline_images_result.imported with the source URL, local URL, and attachment ID. Failed inline images are listed in inline_images_result.warnings; the post is still returned with a warning.
Errors
{
"code": "bad_request",
"message": "Title and Content are required fields",
"data": { "status": 400 }
}400 missing fields · 401 missing key · 403 incorrect key · 500 WordPress insert/update failure.