# Recover failed deliveries (/docs/api-reference/webhook-endpoints/recover-webhook-endpoint)

Queues the endpoint's deliveries that `failed` since `since` for one more attempt each, oldest first, spread over the next minute, e.g. after fixing a receiver that was down. At most 1000 per call: while `has_more` is `true`, call again with the same `since`. The endpoint must be enabled.

`POST https://api.coss.com/v1/webhook_endpoints/{id}/recover`

Authenticate with your API key as a bearer token (`Authorization: Bearer coss_test_…`). Responses are JSON with snake_case fields; errors are `{ error: { type, code, message, param?, issues?, request_id } }` (https://coss.com/docs/api-reference/errors.md).

## Path parameters

- `id` (string, required): The webhook endpoint's id.

## Request body

- `since` (string, required, date-time): Requeue the endpoint's deliveries that failed and were created at or after this time (ISO 8601). Deliveries are kept for 30 days.

## Example request

TypeScript (the `coss` package):

```ts
import { Coss } from "coss";

const coss = new Coss({
  apiKey: process.env.COSS_API_KEY,
  baseUrl: "https://api.coss.com",
});

const { data, error } = await coss.webhookEndpoints.recover("whep_01k7c8m4q2f3e9v6t5r1n0p8yz", {
  since: "2026-01-15T09:00:00.000Z",
});
```

HTTP:

```sh
curl -X POST "https://api.coss.com/v1/webhook_endpoints/whep_01k7c8m4q2f3e9v6t5r1n0p8yz/recover" \
  -H "Authorization: Bearer $COSS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "since": "2026-01-15T09:00:00.000Z"
}'
```

Python:

```python
from coss import Coss
import datetime

client = Coss()  # api_key= or COSS_API_KEY

client.webhook_endpoints.recover(
    id="whep_01k7c8m4q2f3e9v6t5r1n0p8yz",
    since=datetime.datetime.fromisoformat("2026-01-15T09:00:00+00:00"),
)
```

Go:

```go
import (
	"context"

	coss "github.com/cosscom/coss-go"
	cossclient "github.com/cosscom/coss-go/client"
)

client := cossclient.NewClient() // option.WithAPIKey(…) or COSS_API_KEY

request := &coss.RecoverWebhookEndpointRequest{
    ID: "whep_01k7c8m4q2f3e9v6t5r1n0p8yz",
    Since: coss.MustParseDateTime(
        "2026-01-15T09:00:00Z",
    ),
}
client.WebhookEndpoints.Recover(
    context.TODO(),
    request,
)
```

Ruby:

```ruby
require "coss"

client = Coss::Client.new # api_key: or COSS_API_KEY

client.webhook_endpoints.recover(
  id: "whep_01k7c8m4q2f3e9v6t5r1n0p8yz",
  since: "2026-01-15T09:00:00Z"
)
```

PHP:

```php
<?php

use Coss\Coss;
use Coss\WebhookEndpoints\Requests\RecoverWebhookEndpointRequest;

$client = new Coss(); // apiKey: or COSS_API_KEY

$client->webhookEndpoints->recover(
    'whep_01k7c8m4q2f3e9v6t5r1n0p8yz',
    new RecoverWebhookEndpointRequest([
        'since' => new DateTime('2026-01-15T09:00:00Z'),
    ]),
);
```

Java:

```java
import com.coss.Coss;
import com.coss.resources.webhookendpoints.requests.RecoverWebhookEndpointRequest;
import java.time.OffsetDateTime;

Coss client = Coss.builder().build(); // .apiKey(…) or COSS_API_KEY

client.webhookEndpoints().recover(
    "whep_01k7c8m4q2f3e9v6t5r1n0p8yz",
    RecoverWebhookEndpointRequest
        .builder()
        .since(OffsetDateTime.parse("2026-01-15T09:00:00Z"))
        .build()
);
```

.NET:

```csharp
using Coss;

var client = new CossClient(); // apiKey: or COSS_API_KEY

await client.WebhookEndpoints.RecoverAsync(
    new RecoverWebhookEndpointRequest
    {
        Id = "whep_01k7c8m4q2f3e9v6t5r1n0p8yz",
        Since = new DateTime(2026, 01, 15, 09, 00, 00, 000),
    }
);
```

## Response 200

How many deliveries were queued.

- `object` ("webhook_endpoint_recovery", required)
- `endpoint_id` (string, required)
- `requeued` (integer, required): How many failed deliveries were queued for one more attempt. Their attempts are spread over the next minute.
- `has_more` (boolean, required): At most 1,000 are requeued per call; `true` means call again with the same `since`.

Example:

```json
{
  "object": "webhook_endpoint_recovery",
  "endpoint_id": "whep_01k7c8m4q2f3e9v6t5r1n0p8yz",
  "requeued": 12,
  "has_more": false
}
```

## Errors

- `400`: The body is not valid JSON (`invalid_json`). Also when the `Coss-Version` header names an unknown API version (`invalid_api_version`).
- `401`: The API key is missing, invalid, revoked or expired (`authentication_error`).
- `403`: The API key lacks the permission this endpoint needs (`permission_error`), or its organization is suspended (`organization_suspended`).
- `404`: No webhook endpoint with this id exists in the API key's environment (`not_found`).
- `413`: The request body is larger than 5 MB (`payload_too_large`).
- `415`: The body is not sent as `application/json` (`unsupported_media_type`).
- `422`: The body failed validation (`validation_error`), or the endpoint is disabled (`endpoint_disabled`).
- `429`: Too many requests with this API key (`rate_limited`), or too many requests with invalid keys from this address (`too_many_failed_authentications`). Retry after `Retry-After` seconds. Successful responses carry `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` (seconds until the limit is fully restored).
- `500`: Unexpected server error (`api_error` / `internal_error`).
- `503`: The API key could not be verified right now; retry (`service_unavailable`).