API Reference / Posts

Edit a draft

PostPiper API: update an existing draft's text, image attachments, or Pinterest fields. Only unpublished drafts can be edited with PATCH.

PATCHhttps://api.postpiper.ai/v1/posts/{postId}

Only drafts can be edited. Omitted fields keep their values. Supplying asset_ids replaces attached assets in order; an empty array detaches them all. The draft must still contain text or media after editing.

You cannot change the platform or account with this endpoint.

Path and query parameters

NameTypeDescription
postIdUUID, requiredID of an owned draft.

Request body

NameTypeDescription
platform_fieldsobject, optionalReplacement Pinterest fields. Supplied keys replace previous values; omitted keys are kept.
contentstring, optionalReplacement text, up to 25,000 characters.
media_urlsstring[], optionalReplacement HTTPS image URLs; cannot be sent with asset_ids.
asset_idsUUID[], optionalReplacement owned X image assets; cannot be sent with media_urls.

Example request

Terminal
curl -X PATCH "https://api.postpiper.ai/v1/posts/<post-uuid>" \
  -H "Authorization: Bearer $POSTPIPER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"content":"Updated post text"}'

Response

200 OK. Returns the updated draft.

JSON
{
  "post": {
    "id": "<post-uuid>",
    "content": "Updated post text",
    "media_urls": [],
    "asset_ids": [],
    "platform": "x",
    "status": "draft",
    "account_id": "<account-uuid>",
    "created_at": "2030-10-12T01:00:00.000Z"
  }
}

Errors

  • 400INVALID_CONTENT or MEDIA_FORMAT_CONFLICT.
  • 401Missing or invalid API key.
  • 403API key lacks the required scope.
  • 404POST_NOT_FOUND or MEDIA_NOT_FOUND.
  • 409POST_NOT_DRAFT.