# Reply to a comment

Posts a public reply on TikTok to one comment, from the post's account. POST /comments/{commentId}/replies.

`POST https://api.tiktornado.com/api/v1/comments/{commentId}/replies`

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

Posts a public reply on TikTok to one comment, from the post's account. TikTok threads are one level deep, so a reply to a reply goes under its top-level comment. The answer's status is `posting` until TikTok has the reply. Follow it with `GET /posts/{postId}/comments`, where it shows as `sent` or `failed`.

## Path parameters

- `commentId` string, required: The comment to answer, from `GET /posts/{postId}/comments`. 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

- `text` string, required: The reply, 1 to 150 characters after spaces at either end are removed, each emoji counted once (`reply_length`). At least 1 character.

## Examples

```bash
curl -X POST 'https://api.tiktornado.com/api/v1/comments/m5713dgy8c0x4pzjqv2nrh6w9a87b1k3/replies' \
  -H "Authorization: Bearer $TIKTORNADO_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Thank you! New video drops Friday."
  }'
```

```js
const response = await fetch("https://api.tiktornado.com/api/v1/comments/m5713dgy8c0x4pzjqv2nrh6w9a87b1k3/replies", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TIKTORNADO_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "text": "Thank you! New video drops Friday."
  }),
});
const data = await response.json();
```

```python
import os
import uuid

import requests

response = requests.post(
    "https://api.tiktornado.com/api/v1/comments/m5713dgy8c0x4pzjqv2nrh6w9a87b1k3/replies",
    headers={
        "Authorization": f"Bearer {os.environ['TIKTORNADO_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "text": "Thank you! New video drops Friday.",
    },
)
data = response.json()
```

## Response 201

The reply is on its way to TikTok.

- `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 `posting`.

```json
{
  "id": "n9762hzw4f1c8tqx0a3bdm5k2r87v6j4",
  "status": "posting"
}
```

## 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 | `reply_length` | Write a reply of up to 150 characters. |
| 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 on our side. We're on it. |
| 503 | `service_unavailable` | Something went wrong on our side. We're on it. |