Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

Replays

Send a range of history again, to one subscription or every subscription of an endpoint. A replay makes new matches and deliveries, with new webhook-id values and the events’ own id, and never changes the old ones.

Replays explains what a replay sends and how a receiver tells it apart.

Paths are relative to https://api.agentpost.tools/v1/events, and every request follows the API basics. Who may call explains each kind of caller.

Replay events

POST /replays

Starts a replay, which answers 202 and runs in the background. With dryRun: true it answers 200 with preview, what it would send, and writes nothing: run that first, and start the replay once the counts are what you meant. A disabled endpoint, a deleted subscription with definitions: "current", and a subscription with a notification target answer conflict.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: optional. Retrying a write has the rule.

Body

Name Type Required Description
filter object No
filter.types string[] No 1–50 items.
filter.sources string[] No 1–50 items.
filter.extensions object No Each value is a string or string[].
filter.workspace string No The workspace it belongs to, when the app groups its principals into workspaces; 1–200 characters.
filter.subject string No 1–500 characters.
filter.refs object[] No 1–20 items.
filter.refs[].type string Yes 1–100 characters.
filter.refs[].id string No 1–500 characters.
filter.where object No Each value is a string or string[].
from string Yes An ISO 8601 date and time.
to string Yes An ISO 8601 date and time.
target object Yes
target.subscriptionId string No
target.endpointId string No
definitions string Yes One of "current" or "historical".
dryRun boolean No Default false.

Response

202 Accepted, with:

Name Type Present Description
replay ReplayRecord When set
preview ReplayPreview When set

Errors

Any operation can also answer with the codes Conventions lists.

List replays

GET /replays

Replays, newest first.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Pages: limit, 1 to 200, default 50, with next and after. Lists has the rule.

Query parameters

Name Type Required Description
status string No One of "running", "completed", "canceled", or "failed".
subscriptionId string No
endpointId string No
after string No
limit integer No 1–200; default 50.

Response

200 OK, with:

Name Type Present Description
replays ReplayRecord array Always
next string When set

Errors

Any operation can also answer with the codes Conventions lists.

Get a replay

GET /replays/:id

One replay, with its counts so far.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.

Path parameters

Name Type Required Description
id string Yes A replay ID, rpl_…. The id of a ReplayRecord.

Response

200 OK, with:

Name Type Present Description
replay ReplayRecord Always

Errors

Any operation can also answer with the codes Conventions lists.

Cancel a replay

POST /replays/:id/cancel

Stops a running replay. What it already queued is still delivered.

  • Who may call: Your server, with your project’s secret key.
  • Credential: the examples send your project’s dev secret key, sk_test_…, as Authorization: Bearer <token>.
  • Idempotency-Key: optional. Retrying a write has the rule.

Path parameters

Name Type Required Description
id string Yes A replay ID, rpl_…. The id of a ReplayRecord.

Response

200 OK, with:

Name Type Present Description
replay ReplayRecord Always

Errors

Any operation can also answer with the codes Conventions lists.

The ReplayRecord object

Name Type Present Description
id string Always A replay ID, rpl_….
filter object Always
filter.types string[] When set 1–50 items.
filter.sources string[] When set 1–50 items.
filter.extensions object When set Each value is a string or string[].
filter.workspace string When set The workspace it belongs to, when the app groups its principals into workspaces; 1–200 characters.
filter.subject string When set 1–500 characters.
filter.refs object[] When set 1–20 items.
filter.refs[].type string Always 1–100 characters.
filter.refs[].id string When set 1–500 characters.
filter.where object When set Each value is a string or string[].
from string Always
to string Always
target object Always
target.subscriptionId string When set
target.endpointId string When set
definitions string Always One of "current" or "historical".
status string Always One of "running", "completed", "canceled", or "failed".
counts object Always
counts.scanned number Always Events in the range that met the filter.
counts.matched number Always Matches written, one per event and subscription.
counts.deliveries number Always Deliveries written, including those skipped for a disabled endpoint.
cursor number When set The last sequence scanned. Progress, and where a resumed replay would pick up.
error string When set Why it failed, when it did.
requestedBy string Always
createdAt string Always
completedAt string When set

The ReplayPreview object

The answer to a dry run: what a replay would do, with nothing written. It counts up to 5,000 events; partial marks a longer range.

Name Type Present Description
dryRun true Always
target object Always
target.subscriptionId string When set
target.endpointId string When set
definitions string Always One of "current" or "historical".
counts object Always
counts.scanned number Always Events in the range that met the filter.
counts.matched number Always Matches written, one per event and subscription.
counts.deliveries number Always Deliveries written, including those skipped for a disabled endpoint.
partial boolean When set True when the preview stopped before the range’s end; cursor is the last sequence it counted.
cursor number When set