---
title: "Validate a post body"
description: "PubNio API posts.validateBody: validate a post body. Request fields, examples in five clients, errors, and idempotency."
---

> Documentation Index
> Fetch the complete documentation index at: https://pubnio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate a post body

Validate a post body with [`POST /api/v1/posts/validate`](https://pubnio.com/api/v1/docs#tag/posts/POST/api/v1/posts/validate). Requires an API key with the `read` scope or a signed-in workspace member.

## Request

Check a CreatePost body as a direct submission regardless of isDraft. Returns destination readiness, content, scheduling, and publish permission issues, plus a billing estimate. It never saves a post, reserves a slot, or contacts a provider.

| Parameter     | In    | Type | Required |
| ------------- | ----- | ---- | -------- |
| `workspaceId` | query | UUID | Yes      |

| Body field       | Type                       | Required |
| ---------------- | -------------------------- | -------- |
| `text`           | string                     | No       |
| `platforms`      | array of one of 12 strings | No       |
| `accounts`       | array of UUID              | No       |
| `targets`        | array of CreatePostTarget  | No       |
| `media`          | array of MediaInput        | No       |
| `scheduledAt`    | string                     | No       |
| `publishNow`     | boolean                    | No       |
| `isDraft`        | boolean                    | No       |
| `allowDuplicate` | boolean                    | No       |

## Response

- HTTP 200: `PostValidation` with `canPublish`, `errors`, `warnings`, `targets`, `billing`.

The [OpenAPI document](https://pubnio.com/api/v1/openapi) has each field's type.

## Examples

### TypeScript

```ts
const validation = await workspace.posts.validateBody({
  text: "Behind the scenes at the shoot.",
  platforms: ["instagram"],
});
```

### Python

```python
validation = workspace.posts.validate_body(
    text="Behind the scenes at the shoot.",
    platforms=["instagram"],
)
```

### cURL

```sh
curl -X POST "https://pubnio.com/api/v1/posts/validate?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Behind the scenes at the shoot.","platforms":["instagram"]}'
```

### CLI

No `pnio` command calls this operation.

### MCP execute

```js
async () => {
  const response = await codemode.request({
    method: "POST",
    path: "/api/v1/posts/validate",
    query: { workspaceId: codemode.workspaceId },
    body: {
      text: "Behind the scenes at the shoot.",
      platforms: ["instagram"],
    },
  });
  return response.data;
};
```

## Errors

It declares no problem of its own.

It declares the problems [most operations](https://pubnio.com/docs/reference/#shared-problems) declare.

## Idempotency

No key, so a retried `POST` is not deduplicated. Read the current state before you retry.

## Limits

- Field lengths and ranges are in the [OpenAPI document](https://pubnio.com/api/v1/openapi).

## Related

- [Posts operations](https://pubnio.com/docs/reference/#posts)
- [Publishing](https://pubnio.com/docs/publishing/)
- [Post lifecycle](https://pubnio.com/docs/concepts/post-lifecycle/)

Source: https://pubnio.com/docs/reference/posts-validate-body/index.mdx
