# Change a post's time, status, settings or attachments

> For AI agents: the index of these docs is at https://indrava.forumulate.com/docs/llms.txt (every page it lists has a Markdown version like this one).

## Change a post's time, status, settings or attachments

**`PATCH http://localhost:4000/api/v1/posts/{id}`** — Change a post's time, status, settings or attachments

Send only what changes. `scheduledAt` moves the post; `action` is as in `POST /posts` (`draft` takes it off the schedule, `schedule` and `now` need the `posts:publish` scope) and defaults to what the post is now; `targets[].settings` replaces the settings of that channel; `mediaIds` replaces the attachments of the first part and `text` its text. With `targetIds` (ids of the post's `targets`), `text` and `mediaIds` change only those channels' copies: each gets a text of its own and the others keep theirs. The channels, tags and client stay as they are. Every check of `POST /posts` applies, and only drafts and scheduled posts can be changed.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `action` | string | no | One of: `draft` \| `schedule` \| `now`. |
| `scheduledAt` | string | no |  |
| `targets` | object[] | no |  |
| `targets.channelId` | string | yes |  |
| `targets.settings` | object | yes |  |
| `mediaIds` | string[] | no |  |
| `text` | string | no |  |
| `targetIds` | string[] | no |  |

```json
{
  "action": "draft",
  "scheduledAt": "2024-01-01T00:00:00Z",
  "targets": [
    {
      "channelId": "string",
      "settings": {}
    }
  ],
  "mediaIds": [
    "string"
  ],
  "text": "string",
  "targetIds": [
    "string"
  ]
}
```

### Responses

**200** — OK

#### Fields

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |

```json
{
  "id": "string"
}
```

### Code samples

**cURL**

```curl
curl -X PATCH "http://localhost:4000/api/v1/posts/{id}" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action":"draft","scheduledAt":"2024-01-01T00:00:00Z","targets":[{"channelId":"string","settings":{}}],"mediaIds":["string"],"text":"string","targetIds":["string"]}'
```

**TypeScript**

```typescript
const res = await fetch('http://localhost:4000/api/v1/posts/{id}', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer $API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"action":"draft","scheduledAt":"2024-01-01T00:00:00Z","targets":[{"channelId":"string","settings":{}}],"mediaIds":["string"],"text":"string","targetIds":["string"]}),
});
const data = await res.json();
```

**Python**

```python
import requests

res = requests.request(
    "PATCH",
    "http://localhost:4000/api/v1/posts/{id}",
    headers={
    "Authorization": "Bearer $API_KEY",
    "Content-Type": "application/json",
    },
    json={"action": "draft", "scheduledAt": "2024-01-01T00:00:00Z", "targets": [{"channelId": "string", "settings": {}}], "mediaIds": ["string"], "text": "string", "targetIds": ["string"]},
)
data = res.json()
```

**Go**

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	req, _ := http.NewRequest("PATCH", "http://localhost:4000/api/v1/posts/{id}", strings.NewReader(`{"action":"draft","scheduledAt":"2024-01-01T00:00:00Z","targets":[{"channelId":"string","settings":{}}],"mediaIds":["string"],"text":"string","targetIds":["string"]}`))
	req.Header.Set("Authorization", "Bearer $API_KEY")
	req.Header.Set("Content-Type", "application/json")
	res, _ := http.DefaultClient.Do(req)
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)
	fmt.Println(string(body))
}
```

**PHP**

```php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost:4000/api/v1/posts/{id}');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer $API_KEY', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"action":"draft","scheduledAt":"2024-01-01T00:00:00Z","targets":[{"channelId":"string","settings":{}}],"mediaIds":["string"],"text":"string","targetIds":["string"]}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;
```

**Ruby**

```ruby
require 'net/http'
require 'uri'

uri = URI('http://localhost:4000/api/v1/posts/{id}')
req = Net::HTTP::Patch.new(uri)
req['Authorization'] = 'Bearer $API_KEY'
req['Content-Type'] = 'application/json'
req.body = '{"action":"draft","scheduledAt":"2024-01-01T00:00:00Z","targets":[{"channelId":"string","settings":{}}],"mediaIds":["string"],"text":"string","targetIds":["string"]}'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(req)
end
puts res.body
```

**Java**

```java
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpRequest.BodyPublishers;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("http://localhost:4000/api/v1/posts/{id}"))
    .header("Authorization", "Bearer $API_KEY")
    .header("Content-Type", "application/json")
    .method("PATCH", BodyPublishers.ofString("{\"action\":\"draft\",\"scheduledAt\":\"2024-01-01T00:00:00Z\",\"targets\":[{\"channelId\":\"string\",\"settings\":{}}],\"mediaIds\":[\"string\"],\"text\":\"string\",\"targetIds\":[\"string\"]}"))
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

---

## For AI agents

- This page for a human reader: https://indrava.forumulate.com/docs/ref-posts-patch
- The whole space as one Markdown file: https://indrava.forumulate.com/docs/llms-full.txt
- Live search + fetch over MCP: https://indrava.forumulate.com/docs/_api/public/orgs/e421ace4-3e78-4ed8-9818-7b4899cf3aa0/spaces/2bcc7f09-4489-40af-85d8-9fdd3f3da314/mcp
  - Install (Claude CLI): `claude mcp add forumulate-docs --transport http https://indrava.forumulate.com/docs/_api/public/orgs/e421ace4-3e78-4ed8-9818-7b4899cf3aa0/spaces/2bcc7f09-4489-40af-85d8-9fdd3f3da314/mcp`

This Markdown is the same content the page renders — safe to quote and to ground answers in.
