EditPost#
Beta version
The functionality is in beta. Features may change and may also work unstably.
The method edits a post of the account: the caption and the comments permission.
The media file of the post is not replaced and the composition of a carousel is not edited: only the listed fields can be changed.
Reels are edited by the EditReel method.
The method uses the limits on the number of requests per second.
Request#
To edit a post, you have to execute a request at:
{{apiUrl}}/waInstance{{idInstance}}/editPost/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Request parameters#
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
postId | string | Yes | The post identifier |
caption | string | No* | The new caption, up to 2200 characters. Not set - the caption stays as it was |
disableComments | boolean | No* | true closes the comments to the post, false opens them. Not set - the permission stays as it was |
At least one of the
captionanddisableCommentsfields must be passed: otherwise the method responds withValidation failed. Details: 'caption' or 'disableComments' is required.
Request body example#
Change the caption of a post:#
{
"postId": "2907515653209522683",
"caption": "The new caption"
}
Close the comments of a post:#
{
"postId": "2907515653209522683",
"disableComments": true
}
Response#
Response parameters#
| Field | Type | Description |
|---|---|---|
postId | string | The identifier of the edited post - in the same form it was in the request |
Response body example#
{
"postId": "2907515653209522683"
}
EditPost errors#
For a list of errors common to all methods, refer to the Common errors section
| HTTP code | Error ID | Description |
|---|---|---|
| 400 | Bad Request Validation failed | Validation error |
| 400 | Validation failed. Details: 'caption' or 'disableComments' is required | Not a single editable field is passed |
Refusals in the notification#
The command is executed through the queue: the method responds with 200 and postId at once. If the command could not be executed, the editPostStatus notification arrives with status = failed, the reason is in the description field:
description | Description |
|---|---|
post 2907515653209522683 belongs to another account | The post belongs to another account |
reel 3977953643059237032 belongs to another account | The Reel belongs to another account |
not found | There is no post with this identifier in Instagram |
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/editPost/{{apiTokenInstance}}"
payload = {
"postId": "2907515653209522683",
"caption": "The new caption"
}
headers = {'Content-Type': 'application/json'}
response = requests.post(url, json=payload, headers=headers)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/editPost/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"postId": "2907515653209522683",
"caption": "The new caption"
}'