ResourceShark API reference
Every operation ResourceShark serves, generated from its contract, so these pages match the API. Every request follows the API basics. Start with the ResourceShark quickstart if you are new, and use the SDK from TypeScript.
For tools that read OpenAPI, /docs/resourceshark/openapi.json describes every operation here as OpenAPI 3.1, with its credentials, schemas, examples, and error codes.
Who may call
- Your server sends the project’s secret key. It can call every operation.
- A signed-in principal sends a user token and can read only their own
principal:<principal>holder records on operations that list this caller.
Platform credentials explains each credential.
Retrying a write
Retrying a write has the rule every API follows. ResourceShark adds two rules of its own. An Idempotency-Key belongs to one caller and one operation. A retry repeats the first answer even when it was an error, except for the following codes, where ResourceShark checks the request again.
invalid_requestpayload_too_largeunauthenticatedforbiddenidempotency_mismatchconflictcursor_expiredduplicate_sourceinternal_error
Source keys explains how a write also identifies the change it makes.
Conventions
What this API sets for every operation in this reference. API basics has the rules themselves, and its table compares the APIs.
- Base URL: every path here starts with
https://api.agentpost.tools/v1/resources. - Idempotency: Every write (
POST,PUT,PATCH,DELETE) takesIdempotency-Key, except Check availability, whose entries say why. A key’s first answer is kept for 24 hours. It is required on Add supply, Reverse supply, Place a hold, Extend a hold, Commit a hold, Release a hold, Cancel a committed hold, Reschedule a hold, Consume supply, Settle an estimated claim, Create a schedule exception, Transfer stock, Record a count, Adjust stock, Record a conversion. Retrying a write has the rule, with the codesidempotency_mismatchandconflictit answers with. - Lists: Every paginated list takes
limit, 1 to 500, default 100. List resources, List places, List instances, List free instances, List supply, List batches, List a holder’s balances, List holds, and List claims page withnextandafter. List movements and Read events are feeds. List schedule exceptions and List slots answer in one response. Lists has the rule. - IDs: each ID starts with its kind’s prefix, as IDs lists.
- Errors: An error’s
docslink goes to its code’s entry on ResourceShark errors. Any operation can answer withunauthenticated,forbidden, orinternal_error; each operation lists the other codes it can answer with. Errors describes the body.
IDs
| Kind | Looks like |
|---|---|
| Place | plc_… |
| Instance | ins_… |
| Resource | res_… |
| Supply | sup_… |
| Claim | clm_… |
| Movement | mov_… |
| Transfer | trf_… |
| Hold | hld_… |
| Batch | bat_… |
| Transformation | tfm_… |
| Exception | exc_… |
Resources
Each resource has its own page, with its operations, their examples, and the objects they answer with.
| Resource | What it holds |
|---|---|
| Config | Read or replace the project’s versioned retention settings. |
| Resources | Define what you count, how it is measured, and which scopes hold it. Read, edit, or archive a resource. |
| Places | Create, list, and edit the places where stock is kept. |
| Instances | Track individual units of a resource. Set when a unit is unavailable and find units that are free for a request. |
| Supply | Record, read, and take back supply that is on hand or due. |
| Batches | Group supply entries for a resource by batch and manage their expiry. |
| Availability | Check how much a request could take, or read balances by resource, scope, or holder. |
| Holds | Reserve supply until a hold expires. Extend or release a hold, commit what it reserves, or cancel or reschedule lines where allowed. |
| Claims | Take supply, settle an estimated quantity, or read claim records. |
| Schedules | Read or set a resource’s recurring capacity, and manage dated exceptions to it. |
| Slots | See how much capacity is held, taken, or free in each time bucket for a resource. |
| Stock | Transfer, count, adjust, or convert stock. |
| Movements | Read the movements that record changes to balances. |
| Reports | Read balance totals and sum movements by reason over a period. |
| Events | Read the project’s change feed in order from a cursor. |