REST API: knowledge-base.article.create

I am attempting to create a very simple article in the KB by posting the following body, but I receive a validation error that I can’t figure out. I have confirmed that article.meta.categories.name is correct, as well as the id. I also tried the slug instead of the name with the same result.

Body:

{
    "propertyId": "xxx9f7c37xxx12e96xxxxx",
    "article": {
        "content": {
            "siteId": "primary",
            "title": "Toolbox Test Article Title 4.5",
            "status": "draft",
            "subtitle": "Toolbox Test Article Subtitle",
            "contents": [
                {
                    "content": {
                        "text": "<p>This is an example paragraph.</p>",
                        "size": 18,
                        "color": "#000000",
                        "backgroundColor": "#FFFFFF"
                    },
                    "type": "paragraph"
                }
            ],
            "author": "xxxc554cb2xxxe1daxxx",
            "slug": "toolbox-test-article"
        },
        "meta": {
            "visibility": "public",
            "categories": [
                {
                    "id": "xxxb241c8e8cxxxe41xxxx",
                    "name": "Developers",
                    "primary": true
                }
            ],
            "relatedArticles": []
        }
    }
}

Error:

{
    "ok": false,
    "error": "validation_error",
    "message": "article.meta.categories[0].name"
}

Can anyone tell me what I’m missing or doing wrong?

There is also a bug report here with no resolution:
community.tawk.to/t/400-bad-request-validation-error-article-meta-categories-0-name-on-create-article/4847

Hi, jercol,

Thank you for reaching out and reporting the issue. To assist you more efficiently and resolve the matter as quickly as possible, we would suggest booking a remote support session via Zoom.

You can book a call here. Please note that times are shown in 24-hour format, and will be held on Zoom.

We look forward to helping you resolve this issue promptly.

Best regards,

Hi, jercol,

Thank you again for providing the details.

After reviewing, we’ve identified that there is an error in the documentation. The endpoint, article.meta.categories[0].name, is no longer required for this configuration, and it’s safe to remove it. Please try again without it, and see if it makes any difference.

We’ll make sure to update the documentation accordingly to avoid future confusion. Apologies for the inconvenience, and thank you for bringing this to our attention.

Let us know if you run into any further issues—we’re happy to help.

Best regards,

I just tried removing the article.meta.categories[0].name property from the payload, and it results in a HTTP 500 server error:

Body:
{
    "propertyId": "xxx9f7c37xxx12e96xxxxx",
    "article": {
        "content": {
            "siteId": "primary",
            "title": "Toolbox Test Article Title 4.5",
            "status": "draft",
            "subtitle": "Toolbox Test Article Subtitle",
            "contents": [
                {
                    "content": {
                        "text": "<p>This is an example paragraph.</p>",
                        "size": 18,
                        "color": "#000000",
                        "backgroundColor": "#FFFFFF"
                    },
                    "type": "paragraph"
                }
            ],
            "author": "xxxc554cb2xxxe1daxxx",
            "slug": "toolbox-test-article"
        },
        "meta": {
            "visibility": "public",
            "categories": [
                {
                    "id": "xxxb241c8e8cxxxe41xxxx",
                    "primary": true
                }
            ],
            "relatedArticles": []
        }
    }
}
Error:
{
    "ok": false,
    "error": "server_error"
}

Just an update to record a solution to this issue. Tawk support replied via email suggesting that I verify that article.content.slug is unique (and upon reflection, of course it would have to be unique).

Merely changing the slug did not fix the issue but in combination with Janice’s suggestion to remove article.meta.categories[0].name from the body, it did work.

So, for reference, here is an example of creating an article that works:

Body:
{
    "propertyId": "xxx9f7c37xxx12e96xxxxx",
    "article": {
        "content": {
            "siteId": "primary",
            "title": "Toolbox Test Article Title 4.5",
            "status": "draft",
            "subtitle": "Toolbox Test Article Subtitle",
            "contents": [
                {
                    "content": {
                        "text": "<p>This is an example paragraph.</p>",
                        "size": 18,
                        "color": "#000000",
                        "backgroundColor": "#FFFFFF"
                    },
                    "type": "paragraph"
                }
            ],
            "author": "xxxc554cb2xxxe1daxxx",
            "slug": "toolbox-test-article-unique-slug"
        },
        "meta": {
            "visibility": "public",
            "categories": [
                {
                    "id": "xxxb241c8e8cxxxe41xxxx",
                    "primary": true
                }
            ],
            "relatedArticles": []
        }
    }
}

Result: (200 OK)

{
    "ok": true,
    "data": {
        "article": {
            "id": "6847xxxxx3bc51985xxxce0",
            "meta": {
                "visibility": "public",
                "categories": [
                    {
                        "id": "xxxb241c8e8cxxxe41xxxx",
                        "primary": true
                    }
                ],
                "relatedArticles": [],
                "sites": [
                    {
                        "id": "primary",
                        "author": "60xxxx554xxxbe0afxxxxaa9",
                        "status": "draft"
                    }
                ],
                "feedback": {
                    "upvotes": 0,
                    "downvotes": 0,
                    "total": 0
                },
                "createdAt": "2025-06-10T04:38:14.281Z",
                "updatedAt": "2025-06-10T04:38:14.281Z"
            },
            "content": {
                "translationId": "68xxxxb65f5xxx198xxxxxc8",
                "siteId": "primary",
                "title": "Toolbox Test Article Title 4.5",
                "status": "draft",
                "subtitle": "Toolbox Test Article Subtitle",
                "contents": [
                    {
                        "content": {
                            "text": "<p>This is an example paragraph.</p>",
                            "size": 18,
                            "color": "#000000",
                            "backgroundColor": "#FFFFFF"
                        },
                        "type": "paragraph"
                    }
                ],
                "author": "xxxc554cb2xxxe1daxxx",
                "slug": "toolbox-test-article-45",
                "createdAt": "2025-06-10T04:38:14.281Z",
                "updatedAt": "2025-06-10T04:38:14.281Z"
            }
        }
    }
}

It’s worked, but not work on update article {"ok":false,"error":"server_error"}
:slightly_smiling_face:

You beat me to it… I’ll be working on that next and will start a new thread if/when I run into trouble updating!