# Deliveries ## List webhook deliveries `client.Webhooks.Deliveries.List(ctx, webhookID, params) (*WebhookDeliveryListResponse, error)` **get** `/v2/webhooks/{teamId}/{webhookId}/deliveries` An endpoint's deliveries, newest first, with optional status / type / time-range filters and cursor pagination. ### Parameters - `webhookID string` - `params WebhookDeliveryListParams` - `TeamID param.Field[string]` Path param - `After param.Field[Time]` Query param: Only deliveries at or after this ISO-8601 timestamp. - `Before param.Field[Time]` Query param: Only deliveries at or before this ISO-8601 timestamp. - `Cursor param.Field[string]` Query param: Opaque cursor from a previous response's `next_cursor`. - `Limit param.Field[int64]` Query param: Page size (1–100, default 25). - `Status param.Field[WebhookDeliveryListParamsStatus]` Query param: Filter by outcome. - `const WebhookDeliveryListParamsStatusSuccess WebhookDeliveryListParamsStatus = "success"` - `const WebhookDeliveryListParamsStatusFailed WebhookDeliveryListParamsStatus = "failed"` - `Type param.Field[WebhookDeliveryListParamsType]` Query param: Filter by run type. Defaults to `delivery` (event deliveries). Pass `all` to include verification handshakes. - `const WebhookDeliveryListParamsTypeDelivery WebhookDeliveryListParamsType = "delivery"` - `const WebhookDeliveryListParamsTypeVerification WebhookDeliveryListParamsType = "verification"` - `const WebhookDeliveryListParamsTypeAll WebhookDeliveryListParamsType = "all"` ### Returns - `type WebhookDeliveryListResponse struct{…}` - `Data []WebhookDelivery` - `CreatedAt Time` - `DeliveryID string` - `Status WebhookDeliveryStatus` - `const WebhookDeliveryStatusSuccess WebhookDeliveryStatus = "success"` - `const WebhookDeliveryStatusFailed WebhookDeliveryStatus = "failed"` - `Type WebhookDeliveryType` - `const WebhookDeliveryTypeDelivery WebhookDeliveryType = "delivery"` - `const WebhookDeliveryTypeVerification WebhookDeliveryType = "verification"` - `WebhookID string` - `Attempts int64` Number of attempts made so far (including async retries). - `Event string` Event name (e.g. `webhook.test`); `verification` for handshake runs. - `StatusCode int64` HTTP status of the latest attempt; null on a transport error. - `TeamID string` - `UpdatedAt Time` - `URL string` - `NextCursor string` Pass as `cursor` to fetch the next page; null when there are no more. ### Example ```go package main import ( "context" "fmt" "github.com/micro-so/micro-sdk-go" "github.com/micro-so/micro-sdk-go/option" ) func main() { client := micro.NewClient( option.WithAPIKey("My API Key"), option.WithTeamID("My Team ID"), ) deliveries, err := client.Webhooks.Deliveries.List( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", micro.WebhookDeliveryListParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", deliveries.Data) } ``` #### Response ```json { "data": [ { "created_at": "2019-12-27T18:11:19.117Z", "delivery_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "status": "success", "type": "delivery", "webhook_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "attempts": 0, "event": "event", "status_code": 0, "team_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "updated_at": "2019-12-27T18:11:19.117Z", "url": "url" } ], "next_cursor": "next_cursor" } ``` ## Get a delivery `client.Webhooks.Deliveries.Get(ctx, webhookID, deliveryID, query) (*WebhookDeliveryDetail, error)` **get** `/v2/webhooks/{teamId}/{webhookId}/deliveries/{deliveryId}` A single delivery plus its full attempt timeline (including async retries). ### Parameters - `webhookID string` - `deliveryID string` - `query WebhookDeliveryGetParams` - `TeamID param.Field[string]` ### Returns - `type WebhookDeliveryDetail struct{…}` A delivery plus its full attempt timeline. - `AttemptHistory []WebhookDeliveryDetailAttemptHistory` - `Attempt int64` 1-based attempt number. - `CreatedAt Time` - `Status WebhookDeliveryDetailAttemptHistoryStatus` - `const WebhookDeliveryDetailAttemptHistoryStatusSuccess WebhookDeliveryDetailAttemptHistoryStatus = "success"` - `const WebhookDeliveryDetailAttemptHistoryStatusFailed WebhookDeliveryDetailAttemptHistoryStatus = "failed"` - `Error string` Failure reason, when status is failed. - `RequestBody string` Body sent to the endpoint (delivery only); may be truncated. - `ResponseBody string` Body returned by the endpoint; may be truncated. - `StatusCode int64` ### Example ```go package main import ( "context" "fmt" "github.com/micro-so/micro-sdk-go" "github.com/micro-so/micro-sdk-go/option" ) func main() { client := micro.NewClient( option.WithAPIKey("My API Key"), option.WithTeamID("My Team ID"), ) webhookDeliveryDetail, err := client.Webhooks.Deliveries.Get( context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", micro.WebhookDeliveryGetParams{ }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", webhookDeliveryDetail) } ``` #### Response ```json { "created_at": "2019-12-27T18:11:19.117Z", "delivery_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "status": "success", "type": "delivery", "webhook_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "attempts": 0, "event": "event", "status_code": 0, "team_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "updated_at": "2019-12-27T18:11:19.117Z", "url": "url", "attempt_history": [ { "attempt": 0, "created_at": "2019-12-27T18:11:19.117Z", "status": "success", "error": "error", "request_body": "request_body", "response_body": "response_body", "status_code": 0 } ] } ```