---
title: "Retry a failed delivery"
description: "PubNio API posts.retry: retry a failed delivery. Request fields, examples in five clients, errors, and idempotency."
---

> Documentation Index
> Fetch the complete documentation index at: https://pubnio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Retry a failed delivery

Retry a failed delivery with [`POST /api/v1/posts/{postId}/targets/{targetId}/retry`](https://pubnio.com/api/v1/docs#tag/posts/POST/api/v1/posts/{postId}/targets/{targetId}/retry). Requires an API key with the `publish` scope or a signed-in workspace owner.

## Request

Retry the frozen content for one failed destination. Repeating the same expected attempt ID returns the same replacement. Uncertain publications require reconciliation.

Pass the `attemptId` you read from [`GET /api/v1/posts/{postId}`](https://pubnio.com/api/v1/docs#tag/posts/GET/api/v1/posts/{postId}) as `expectedAttemptId`. A retry makes a replacement attempt with status `queued` that reuses the failed attempt's frozen revision and content snapshot, so edits made since then are not sent.

Sending the same `expectedAttemptId` again returns that same replacement attempt instead of making a second one. If the target's current attempt is another one, the call fails with `attempt-changed` and names `currentAttemptId`.

A deleted post, or an attempt that is not `failed` with evidence the provider did not publish it, fails with `delivery-not-retryable`; create a new post for that destination instead.

| Parameter     | In    | Type | Required |
| ------------- | ----- | ---- | -------- |
| `postId`      | path  | UUID | Yes      |
| `targetId`    | path  | UUID | Yes      |
| `workspaceId` | query | UUID | Yes      |

| Body field          | Type | Required |
| ------------------- | ---- | -------- |
| `expectedAttemptId` | UUID | Yes      |

## Response

- HTTP 202: an object with `targetId`, `attemptId`, `accountId`, `scheduledAt`, `queueId`, `slotId`, `assignmentId`, `occurrenceDate`, `localDate`, `localTime`, `timezone`, `status`.
  - `status`: `scheduled`, `queued`, `submitting`, `confirming`, `published`, `provider_draft`, `failed`, `unresolved`, `cancelled`

The [OpenAPI document](https://pubnio.com/api/v1/openapi) has each field's type.

## Examples

### TypeScript

```ts
const result = await workspace.posts.retry(postId, targetId, {
  expectedAttemptId: attemptId,
});
```

### Python

```python
result = workspace.posts.retry(
    post_id,
    target_id,
    expected_attempt_id=attempt_id,
)
```

### cURL

```sh
curl -X POST "https://pubnio.com/api/v1/posts/$POST_ID/targets/$TARGET_ID/retry?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $PUBNIO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"expectedAttemptId":"'"$ATTEMPT_ID"'"}'
```

### CLI

```sh
pnio posts retry "$POST_ID" "$TARGET_ID" --expected-attempt-id "$ATTEMPT_ID"
```

### MCP execute

```js
async () => {
  const postId = "<postId>";
  const targetId = "<targetId>";
  const attemptId = "<attemptId>";
  const response = await codemode.request({
    method: "POST",
    path: `/api/v1/posts/${postId}/targets/${targetId}/retry`,
    query: { workspaceId: codemode.workspaceId },
    body: { expectedAttemptId: attemptId },
  });
  return response.data;
};
```

## Errors

- [`attempt-changed`](https://pubnio.com/docs/problems/attempt-changed/): HTTP 409, Delivery attempt changed
- [`delivery-not-retryable`](https://pubnio.com/docs/problems/delivery-not-retryable/): HTTP 409, Delivery cannot be retried

It also declares the problems [most operations](https://pubnio.com/docs/reference/#shared-problems) declare.

## Idempotency

No key. The required `expectedAttemptId` makes a stale retry fail instead of applying twice.

## Limits

- Field lengths and ranges are in the [OpenAPI document](https://pubnio.com/api/v1/openapi).

## Related

- [Posts operations](https://pubnio.com/docs/reference/#posts)
- [Publishing](https://pubnio.com/docs/publishing/)
- [Post lifecycle](https://pubnio.com/docs/concepts/post-lifecycle/)

Source: https://pubnio.com/docs/reference/posts-retry/index.mdx
