# Retry a failed post

Sends a failed post again at once, unchanged. POST /posts/{postId}/retry.

`POST https://api.tiktornado.com/api/v1/posts/{postId}/retry`

Scope: `posts:write`. Needs an `Idempotency-Key` header.

Sends a failed post again at once, unchanged: the same account, media, caption and settings. Send no body, or an empty object.

- Only a `failed` post can be retried (`invalid_state` otherwise, and `post_already_published` for one that is publishing or published).
- It is checked like a new post sent with `postNow`: the account, the daily limit, the account's end, the media and the settings.
- Like any post sent with `postNow`, it is locked from the start: it can't be edited, moved or cancelled unless it fails again.
- A post that failed with reason `tiktok_timeout` is sent as a new try while TikTok may still finish the first one, so it could appear twice on the account. Delete an extra one in the TikTok app.
- To send it at another time instead, edit or move it with `PATCH /posts/{postId}`.

The answer's status is `scheduling` until TikTok's scheduler has it. Follow it with `GET /posts/{postId}`.

## Path parameters

- `postId` string, required: A failed post, from `GET /posts` or `GET /posts/{postId}`. Matches `^[A-Za-z0-9]{1,64}$`.

## Header parameters

- `Idempotency-Key` string, required: A unique string you make up for this change, for example a UUID: 1 to 255 visible ASCII characters, no spaces. Send the same key with the same body to retry safely. Missing or malformed: 400 `idempotency_key_required`, before anything runs. Matches `^[\x21-\x7e]{1,255}$`.

## Request body

Nothing to send. Leave the body out, or send an empty object.



## Examples

### No fields

```bash
curl -X POST 'https://api.tiktornado.com/api/v1/posts/k17b2pz9xq4w8t0cd5fh3nm6a87v2r1e/retry' \
  -H "Authorization: Bearer $TIKTORNADO_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{}'
```

```js
const response = await fetch("https://api.tiktornado.com/api/v1/posts/k17b2pz9xq4w8t0cd5fh3nm6a87v2r1e/retry", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TIKTORNADO_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({}),
});
const data = await response.json();
```

```python
import os
import uuid

import requests

response = requests.post(
    "https://api.tiktornado.com/api/v1/posts/k17b2pz9xq4w8t0cd5fh3nm6a87v2r1e/retry",
    headers={
        "Authorization": f"Bearer {os.environ['TIKTORNADO_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={},
)
data = response.json()
```

## Response 200

The post is on its way to TikTok's scheduler again.

- `Idempotent-Replayed`: `true` when this is the stored answer to an earlier request with the same `Idempotency-Key`. Absent otherwise.

- `id` string, required: An id, letters and digits only. Matches `^[A-Za-z0-9]{1,64}$`.
- `status` string, required: Always `scheduling`.

```json
{
  "id": "k17b2pz9xq4w8t0cd5fh3nm6a87v2r1e",
  "status": "scheduling"
}
```

## Errors

| Status | Reason | Message |
| --- | --- | --- |
| 400 | `invalid_request` | Something here isn't valid. Check it and try again. |
| 400 | `idempotency_key_required` | Send an Idempotency-Key header with every change, so a retry can't make it twice. |
| 400 | `invalid_state` | This can't be done right now. Refresh and try again. |
| 400 | `post_locked` | This post goes out in 10 minutes or less, so it can't be changed now. |
| 400 | `post_already_published` | This post is already live, so it can't be changed. |
| 400 | `account_not_ready` | This account isn't ready to post yet. Or: This account is under review by TikTok, so new posts can't be scheduled right now. |
| 400 | `media_required` | Add a video or photos to this post. |
| 400 | `too_many_photos` | This post has too many photos. TikTok allows up to 35. |
| 400 | `caption_too_long` | Your caption is too long. TikTok allows 2,200 characters on videos and 4,000 on photo posts. |
| 400 | `link_not_allowed` | This link can't be used. Use a public https link to the file. |
| 400 | `past_account_end` | This account ends before that time. Pick an earlier time. |
| 400 | `daily_limit_reached` | This account has hit TikTok's daily posting limit. Pick a later time. |
| 400 | `drafts_no_settings` | Posts sent to drafts can't carry post settings. Add them in the TikTok app. |
| 400 | `ai_label_photo` | Photo posts can only be marked as AI-generated in the TikTok app. Send it to drafts instead. |
| 400 | `setting_videos_only` | This setting only works on video posts. |
| 400 | `setting_photos_only` | This setting only works on photo posts. |
| 400 | `music_conflict` | Pick a track or automatic music, not both. |
| 400 | `auto_music_branded` | Automatic music doesn't work on branded content. Pick a track instead. |
| 400 | `branded_private` | Branded content can't be posted as Only me. |
| 400 | `invalid_post_setting` | One of this post's settings isn't valid. Check it and try again. |
| 401 | `api_key_invalid` | This API key isn't valid. Check it, or create a new one in the app. |
| 403 | `access_locked` | Your subscription isn't active, so this can't be changed right now. Visit Billing to fix it. |
| 403 | `api_scope_missing` | This API key can't do this. Create a key with the access it needs in the app. |
| 404 | `not_found` | We couldn't find this. |
| 409 | `idempotency_in_progress` | A request with this Idempotency-Key is still running. Try again in a moment. |
| 422 | `idempotency_key_reused` | This Idempotency-Key was already used for a different request. Use a new one. |
| 429 | `slow_down` | You're going a bit fast. Wait a moment and try again. |
| 500 | `unknown_error` | Something went wrong. Our team is working hard to fix this ASAP. Please come back later. |
| 503 | `service_unavailable` | Something went wrong. Our team is working hard to fix this ASAP. Please come back later. |