---
title: "confirm_action"
canonical_url: "https://tweetstream.io/docs/api/agent-action-confirm-action"
last_updated: 2026-11-05
---

# confirm_action

Run a held change once the person reads back the 6-digit code emailed for it. Calling it again returns the same outcome without running the change again. Tier confirm: the call only holds the change and returns it. request_confirmation_code emails the person a code; confirm_action runs the change once they read it back. The MCP tool of the same name needs the tweetstream:billing scope.

Canonical URL: https://tweetstream.io/docs/api/agent-action-confirm-action

## `POST /api/agent/actions/confirm_action`

`https://tweetstream.io/api/agent/actions/confirm_action`

## Authorization

| Name | Type | Description |
| --- | --- | --- |
| `Authorization` | `string`, required | Bearer authentication with your TweetStream API key: `Bearer <key>`. |

## Body

| Name | Type | Description |
| --- | --- | --- |
| `challengeId` | `string` | a string at most 128 character(s) long |
| `code` | `string` | a string matching the pattern ^\d{6}$ |
| `pendingActionId` | `string`, required | a string at most 64 character(s) long |

### Body example

```json
{
  "challengeId": "c2f8a1d4e7b03956",
  "code": "482913",
  "pendingActionId": "pa_7Rk2mQ9xL4"
}
```

## Response fields

| Name | Type | Description |
| --- | --- | --- |
| `action` | `enum<string>`, required |  |
| `outcome` | `object`, required |  |
| `outcome.chargedCents` | `number` |  |
| `outcome.effectiveAt` | `string`, required | a string to be decoded into a Date |
| `outcome.kind` | `enum<string>`, required |  |
| `outcome.refund` | `enum<string>` |  |
| `pendingActionId` | `string`, required |  |
| `status` | `enum<string>`, required |  |

## Responses

| Status | Description | Headers |
| --- | --- | --- |
| `200` | Success |  |
| `400` | Invalid input, or the code is wrong (INVALID_CODE) |  |
| `401` | Missing or invalid API key |  |
| `403` | The request carried a foreign Origin |  |
| `404` | No held change with that pendingActionId for this API key (CONFIRMATION_NOT_FOUND) |  |
| `409` | The held change expired (CONFIRMATION_EXPIRED) |  |
| `429` | Rate limit reached (RATE_LIMITED); retry after retryAfterSeconds |  |
| `503` | Temporarily unavailable; retry later |  |

### 200

```json
{
  "action": "cancel_pending_payment",
  "outcome": {
    "chargedCents": 123.45,
    "effectiveAt": "<string>",
    "kind": "applied",
    "refund": "credit"
  },
  "pendingActionId": "<string>",
  "status": "completed"
}
```

### 400

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 401

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 403

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 404

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 409

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 429

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 503

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://tweetstream.io/api/agent/actions/confirm_action \
  --header "Authorization: Bearer $TWEETSTREAM_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "pendingActionId": "pa_7Rk2mQ9xL4"
}'
```

### JavaScript

```javascript
const response = await fetch("https://tweetstream.io/api/agent/actions/confirm_action", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TWEETSTREAM_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "pendingActionId": "pa_7Rk2mQ9xL4"
  }),
});

console.log(response.status, await response.json());
```

### Python

```python
import os
import requests

response = requests.post(
    "https://tweetstream.io/api/agent/actions/confirm_action",
    headers={"Authorization": f"Bearer {os.environ['TWEETSTREAM_API_KEY']}"},
    json={
        "pendingActionId": "pa_7Rk2mQ9xL4",
    },
)

print(response.status_code, response.json())
```
