Skip to content

Validate a post body

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

Validate a post body with 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 has each field’s type.

Examples

const validation = await workspace.posts.validateBody({
  text: "Behind the scenes at the shoot.",
  platforms: ["instagram"],
});
validation = workspace.posts.validate_body(
    text="Behind the scenes at the shoot.",
    platforms=["instagram"],
)
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"]}'

No pnio command calls this operation.

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 declare.

Idempotency

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

Limits

Type to search…

↑↓ navigate↵ selectEsc close