Post Lifecycle

Endpoints:

POST /posts

Token: user

Scope: write_post

Create a post.

On creation, you can automatically update the "personal" stream marker to the post's ID by including update_marker=1 in the query string.

Posts from the same human- or feed-type user cannot contain the same text within 120 seconds.

JSON in the body of the request is also allowed. Normal links and markdown links are parsed by the server by default.

POST Body Data

Name Description
text 256 character-limited string
reply_to Optional ID of another post to reply to
is_nsfw Optional boolean whether the post should be marked as "NSFW" (Not Safe For Work/mature/offensive)
entities.parse_links Optional boolean whether the links should be parsed by the server. Default true
entities.parse_markdown_links Optional boolean whether the markdown links should be parsed by the server. Default true
Example
curl "https://api.pnut.io/v0/posts" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -d "text=The people here are not shy." \
    -X POST \
    -H "X-Pretty-Json: 1"

Returns the created post.

"call for example 1"

PUT /posts/{post_id}

Token: user

Scope: write_post

Edit or "revise" a post.

  • Can only be done within 300 seconds of the original post's creation
  • Can only be done once to a post
  • Must contain the same entities that were in the original post (Positions can change. Links can be formatted in any way, but the URLs have to be the same)

Once a revision has been made, the original post can still be retrieved from the Revisions endpoint.

Reposts made before the revision will continue to point at the original post.

URL Parameters

Name Description
post_id ID of the post to revise

The POST body can be the same as when creating a post. is_nsfw can be changed from an initial post to a revision.

Example
curl "https://api.pnut.io/v0/posts/2392" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -d "text=#system of a down" \
    -X PUT \
    -H "X-Pretty-Json: 1"

Returns the revised post.

"call for example 2"

DELETE /posts/{post_id}

Token: user

Scope: write_post

Delete a post.

URL Parameters

Name Description
post_id ID of the post to delete
Example
curl "https://api.pnut.io/v0/posts/2392" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -X DELETE \
    -H "X-Pretty-Json: 1"

Returns the deleted post.

"call for example 3"