Create a new post in a channel. To create the post as a comment on
another post, provide `root_id`.
##### Permissions
Must have `create_post` permission for the channel the post is being created in.
operationId:CreatePost
parameters:
- name:set_online
in:query
description:Whether to set the user status as online or not.
required:false
schema:
type:boolean
requestBody:
content:
application/json:
schema:
type:object
required:
- channel_id
- message
properties:
channel_id:
type:string
description:The channel ID to post in
message:
type:string
description:The message contents, can be formatted with Markdown
root_id:
type:string
description:The post ID to comment on
file_ids:
type:array
description:A list of file IDs to associate with the post. Note that
posts are limited to 5 files maximum. Please use additional
posts for more files.
items:
type:string
props:
description:A general JSON property bag to attach to the post
type:object
metadata:
description:A JSON object to add post metadata, e.g the post's priority
type:object
properties:
priority:
type:object
description:An object containing the post's priority properties
properties:
priority:
type:string
description:The priority label of the post, could empty, important, or urgent
requested_ack:
type:boolean
description:Set to true to request for acknowledgements
description:Post object to create
required:true
responses:
"201":
description:Post creation successful
content:
application/json:
schema:
$ref:"#/components/schemas/Post"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
/api/v4/posts/ephemeral:
post:
tags:
- posts
summary:Create a ephemeral post
description:>
Create a new ephemeral post in a channel.
##### Permissions
Must have `create_post_ephemeral` permission (currently only given to system admin)
operationId:CreatePostEphemeral
requestBody:
content:
application/json:
schema:
type:object
required:
- user_id
- post
properties:
user_id:
type:string
description:The target user id for the ephemeral post
post:
type:object
required:
- channel_id
- message
description:Post object to create
properties:
channel_id:
type:string
description:The channel ID to post in
message:
type:string
description:The message contents, can be formatted with Markdown
description:Ephemeral Post object to send
required:true
responses:
"201":
description:Post creation successful
content:
application/json:
schema:
$ref:"#/components/schemas/Post"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"/api/v4/posts/{post_id}":
get:
tags:
- posts
summary:Get a post
description:>
Get a single post.
##### Permissions
Must have `read_channel` permission for the channel the post is in or if the channel is public, have the `read_public_channels` permission for the team.
operationId:GetPost
parameters:
- name:post_id
in:path
description:ID of the post to get
required:true
schema:
type:string
- name:include_deleted
in:query
description:Defines if result should include deleted posts, must have 'manage_system' (admin) permission.
required:false
schema:
type:boolean
default:false
responses:
"200":
description:Post retrieval successful
headers:
Has-Inaccessible-Posts:
schema:
type:boolean
description:This header is included with the value "true" if the post is past the cloud's plan limit.
content:
application/json:
schema:
$ref:"#/components/schemas/Post"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
delete:
tags:
- posts
summary:Delete a post
description:>
Soft deletes a post, by marking the post as deleted in the database.
Soft deleted posts will not be returned in post queries.
##### Permissions
Must be logged in as the user or have `delete_others_posts` permission.
operationId:DeletePost
parameters:
- name:post_id
in:path
description:ID of the post to delete
required:true
schema:
type:string
responses:
"200":
description:Post deletion successful
content:
application/json:
schema:
$ref:"#/components/schemas/StatusOK"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
put:
tags:
- posts
summary:Update a post
description:>
Update a post. Only the fields listed below are updatable, omitted
fields will be treated as blank.
##### Permissions
Must have `edit_post` permission for the channel the post is in.
operationId:UpdatePost
parameters:
- name:post_id
in:path
description:ID of the post to update
required:true
schema:
type:string
requestBody:
content:
application/json:
schema:
type:object
required:
- id
properties:
id:
description:ID of the post to update
type:string
is_pinned:
description:Set to `true` to pin the post to the channel it is in
type:boolean
message:
description:The message text of the post
type:string
has_reactions:
description:Set to `true` if the post has reactions to it
type:boolean
props:
description:A general JSON property bag to attach to the post
Must have `read_channel` permission for the channel the post is in or if the channel is public, have the `read_public_channels` permission for the team.
Must have `edit_other_users` permission if the user is not the one marking the post for himself.
__Minimum server version__:5.18
operationId:SetPostUnread
parameters:
- name:user_id
in:path
description:User GUID
required:true
schema:
type:string
- name:post_id
in:path
description:Post GUID
required:true
schema:
type:string
responses:
"200":
description:Post marked as unread successfully
content:
application/json:
schema:
$ref:"#/components/schemas/ChannelUnreadAt"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"404":
$ref:"#/components/responses/NotFound"
"/api/v4/posts/{post_id}/patch":
put:
tags:
- posts
summary:Patch a post
description:>
Partially update a post by providing only the fields you want to update.
Omitted fields will not be updated. The fields that can be updated are
defined in the request body, all other provided fields will be ignored.
##### Permissions
Must have the `edit_post` permission.
operationId:PatchPost
parameters:
- name:post_id
in:path
description:Post GUID
required:true
schema:
type:string
requestBody:
content:
application/json:
schema:
type:object
properties:
is_pinned:
description:Set to `true` to pin the post to the channel it is in
type:boolean
message:
description:The message text of the post
type:string
file_ids:
description:The list of files attached to this post
type:array
items:
type:string
has_reactions:
description:Set to `true` if the post has reactions to it
type:boolean
props:
description:A general JSON property bag to attach to the post
type:string
description:Post object that is to be updated
required:true
responses:
"200":
description:Post patch successful
content:
application/json:
schema:
$ref:"#/components/schemas/Post"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"/api/v4/posts/{post_id}/thread":
get:
tags:
- posts
summary:Get a thread
description:>
Get a post and the rest of the posts in the same thread.
##### Permissions
Must have `read_channel` permission for the channel the post is in or if the channel is public, have the `read_public_channels` permission for the team.
operationId:GetPostThread
parameters:
- name:post_id
in:path
description:ID of a post in the thread
required:true
schema:
type:string
- name:perPage
in:query
description:The number of posts per page
schema:
type:integer
default:0
- name:fromPost
in:query
description:The post_id to return the next page of posts from
schema:
type:string
default:""
- name:fromCreateAt
in:query
description:The create_at timestamp to return the next page of posts from
Pin a post to a channel it is in based from the provided post id string.
##### Permissions
Must be authenticated and have the `read_channel` permission to the channel the post is in.
operationId:PinPost
parameters:
- name:post_id
in:path
description:Post GUID
required:true
schema:
type:string
responses:
"200":
description:Pinned post successful
content:
application/json:
schema:
$ref:"#/components/schemas/StatusOK"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"/api/v4/posts/{post_id}/unpin":
post:
tags:
- posts
summary:Unpin a post to the channel
description:>
Unpin a post to a channel it is in based from the provided post id
string.
##### Permissions
Must be authenticated and have the `read_channel` permission to the channel the post is in.
operationId:UnpinPost
parameters:
- name:post_id
in:path
description:Post GUID
required:true
schema:
type:string
responses:
"200":
description:Unpinned post successful
content:
application/json:
schema:
$ref:"#/components/schemas/StatusOK"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"/api/v4/posts/{post_id}/actions/{action_id}":
post:
tags:
- posts
summary:Perform a post action
description:>
Perform a post action, which allows users to interact with integrations
through posts.
##### Permissions
Must be authenticated and have the `read_channel` permission to the channel the post is in.
operationId:DoPostAction
parameters:
- name:post_id
in:path
description:Post GUID
required:true
schema:
type:string
- name:action_id
in:path
description:Action GUID
required:true
schema:
type:string
responses:
"200":
description:Post action successful
content:
application/json:
schema:
$ref:"#/components/schemas/StatusOK"
"400":
$ref:"#/components/responses/BadRequest"
"401":
$ref:"#/components/responses/Unauthorized"
"403":
$ref:"#/components/responses/Forbidden"
"/api/v4/posts/ids":
post:
tags:
- posts
summary:Get posts by a list of ids
description:>
Fetch a list of posts based on the provided postIDs
##### Permissions
Must have `read_channel` permission for the channel the post is in or if the channel is public, have the `read_public_channels` permission for the team.
operationId:getPostsByIds
requestBody:
content:
application/json:
schema:
type:array
items:
type:string
description:List of post ids
required:true
responses:
"200":
description:Post list retrieval successful
headers:
Has-Inaccessible-Posts:
schema:
type:boolean
description:Indicates whether the posts have been truncated as per the cloud's plan limit.