Batches
Group supply entries for a resource by batch and manage their expiry.
Paths are relative to https://api.agentpost.tools/v1/resources. Who may call explains each credential.
Create a batch
POST /batches
Creates a batch with a code unique within its resource.
- Who may call: Your server, with your project’s secret key.
- Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.batches.create(body) - Idempotency-Key: optional. Retrying a write has the rule.
Body
| Name | Type | Required | Description |
|---|---|---|---|
resourceId |
string |
Yes | 1–256 characters. |
code |
string |
Yes | 1–200 characters. |
expiresAt |
string |
No | An ISO 8601 date and time. |
attributes |
object |
No | Each value is a string. |
Response
201 Created, with BatchResponse.
Errors
invalid_request(400)payload_too_large(413)not_found(404)key_in_use(409)
Any operation can also answer with the codes Conventions lists.
List batches
GET /batches
Lists batches, optionally filtered by resource.
- Who may call: Your server, with your project’s secret key.
- Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.batches.list(query) - Pages:
limit, 1 to 500, default 100, withnextandafter. Lists has the rule.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
resourceId |
string |
No | 1–256 characters. |
after |
string |
No | 1–200 characters. |
limit |
integer |
No | 1–500; default 100. |
Response
200 OK, with BatchesPage.
Errors
invalid_request(400)
Any operation can also answer with the codes Conventions lists.
Get a batch
GET /batches/:id
Reads a batch by ID.
- Who may call: Your server, with your project’s secret key.
- Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.batches.get(id)
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | Batch ID, bat_…. The id of a Batch. |
Response
200 OK, with BatchResponse.
Errors
not_found(404)
Any operation can also answer with the codes Conventions lists.
Update a batch
PATCH /batches/:id
Edits a batch and keeps its live supply in step with its expiry.
- Who may call: Your server, with your project’s secret key.
- Credential: the examples send your project’s
devsecret key,sk_test_…, asAuthorization: Bearer <token>. - SDK:
client.batches.patch(id, body, { ifMatch }) - Idempotency-Key: optional. Retrying a write has the rule.
- If-Match: Required. Send the version you read.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | Batch ID, bat_…. The id of a Batch. |
Body
| Name | Type | Required | Description |
|---|---|---|---|
resourceId |
string |
No | 1–256 characters. |
code |
string |
No | 1–200 characters. |
expiresAt |
string or null |
No | |
attributes |
object or null |
No | Each value is a string. |
Response
200 OK, with BatchResponse.
Errors
invalid_request(400)payload_too_large(413)not_found(404)key_in_use(409)stale_version(409)
Any operation can also answer with the codes Conventions lists.
The BatchResponse object
A batch read or returned from a write.
| Name | Type | Present | Description |
|---|---|---|---|
batch |
Batch |
Always |
The BatchesPage object
One page of batches, with the cursor for the next page when there is one.
| Name | Type | Present | Description |
|---|---|---|---|
batches |
Batch array |
Always | |
next |
string |
When set |
The Batch object
The batch a resource’s supply can name.
| Name | Type | Present | Description |
|---|---|---|---|
id |
string |
Always | Batch ID, bat_…. |
resourceId |
string |
Always | Resource ID, res_…. |
code |
string |
Always | |
expiresAt |
string |
When set | An ISO 8601 date and time. |
attributes |
object |
When set | The business’s own labels. ResourceShark stores them and answers with them. Each value is a string. |
version |
number |
Always | |
createdAt |
string |
Always | An ISO 8601 date and time. |
updatedAt |
string |
Always | An ISO 8601 date and time. |