# Deliveries (https://docs.capy.ai/api-reference/webhooks/deliveries)

`GET https://api.capy.ai/api/v1/webhooks/{id}/deliveries`

Lists an outbound webhook endpoint's most recent deliveries, newest first, with event, state, attempt count, last response status, and next attempt time.

## Authorization

Send an API key as a bearer token: `Authorization: Bearer $CAPY_API_KEY`. See https://docs.capy.ai/api-reference/authentication.md.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |
| `limit` | query | string | no |  |

## Responses

- `200` WebhookDeliveryList: `WebhookDeliveryListEncoded`
- `401` capy/Unauthorized: `capy_UnauthorizedEncoded`
- `403` capy/Forbidden: `capy_ForbiddenEncoded`
- `404` capy/WebhookEndpointNotFound: `capy_WebhookEndpointNotFoundEncoded`
- `429` capy/RateLimited: `capy_RateLimitedEncoded`

## Example

```bash
curl -X GET "https://api.capy.ai/api/v1/webhooks/{id}/deliveries" \
  -H "Authorization: Bearer $CAPY_API_KEY"
```

## Referenced schemas

```json
{
  "WebhookDeliveryListEncoded": {
    "type": "object",
    "properties": {
      "deliveries": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/WebhookDeliveryEncoded"
        }
      }
    },
    "required": [
      "deliveries"
    ],
    "additionalProperties": false
  },
  "WebhookDeliveryEncoded": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "minLength": 15,
        "maxLength": 30,
        "pattern": "^whd_"
      },
      "event": {
        "$ref": "#/components/schemas/OutboundWebhookEvent"
      },
      "threadId": {
        "type": "string"
      },
      "state": {
        "$ref": "#/components/schemas/OutboundWebhookDeliveryState"
      },
      "attempts": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991
      },
      "lastStatus": {
        "anyOf": [
          {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          {
            "type": "null"
          }
        ]
      },
      "lastError": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "nextAttemptAt": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "deliveredAt": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "createdAt": {
        "type": "string"
      }
    },
    "required": [
      "id",
      "event",
      "threadId",
      "state",
      "attempts",
      "lastStatus",
      "lastError",
      "nextAttemptAt",
      "deliveredAt",
      "createdAt"
    ],
    "additionalProperties": false
  },
  "OutboundWebhookEvent": {
    "type": "string",
    "enum": [
      "thread.needs_you",
      "thread.finished",
      "captain.replied"
    ],
    "description": "thread.needs_you: a root thread opened an ask for a person. thread.finished: a thread came to rest with a final reply. captain.replied: a Captain delivered a message to its person."
  },
  "OutboundWebhookDeliveryState": {
    "type": "string",
    "enum": [
      "pending",
      "delivered",
      "failed"
    ],
    "description": "pending: a send is due or in flight; delivered: the endpoint answered 2xx; failed: every attempt of the schedule was spent."
  },
  "capy_UnauthorizedEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/Unauthorized"
        ]
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_ForbiddenEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/Forbidden"
        ]
      },
      "mfaRequiredOrgId": {
        "type": "string"
      },
      "ssoRequired": {
        "type": "boolean"
      },
      "passkeyRequired": {
        "type": "boolean"
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_WebhookEndpointNotFoundEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/WebhookEndpointNotFound"
        ]
      },
      "webhookEndpointId": {
        "type": "string",
        "minLength": 15,
        "maxLength": 30,
        "pattern": "^whe_"
      }
    },
    "required": [
      "_tag",
      "webhookEndpointId"
    ],
    "additionalProperties": false
  },
  "capy_RateLimitedEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/RateLimited"
        ]
      },
      "retryAfterSeconds": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991
      }
    },
    "required": [
      "_tag",
      "retryAfterSeconds"
    ],
    "additionalProperties": false
  }
}
```

Full document: https://docs.capy.ai/openapi.json