Pull the Provider inventory from the vendors
POST /v1/platform/inventory/sync
| Property | Value |
|---|---|
| Operation | sync_inventory |
| Group | Platform |
| Scope | platform:write |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Audited platform.inventory.sync (mutation) |
| Released in | 1.12.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Calls the list endpoints of each named Provider, or of every Provider when none is named, with the Provider's active platform credential, and stores what they list: new items are added, changed names and attributes updated, and items no longer listed marked with missing_since; nothing is deleted. A Provider that fails is reported in its own error and changes nothing; dependency_unavailable answers when no named Provider could be reached. The Audit event records the counts per Provider. No vendor is called on the Call path.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the platform:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X POST "$VOCAL_API/v1/platform/inventory/sync" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch(`${process.env.VOCAL_API}/v1/platform/inventory/sync`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/platform/inventory/sync",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
idempotency-key | header | string | no | A client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response. |
Request body
Content type application/json, required: InventorySyncRequest.
| Field | Type | Required | Description |
|---|---|---|---|
kinds | array of InventoryKind | no | Models, voices or both; both when omitted. |
providers | array of ProviderId | no | The Providers to sync; every Provider with a list when omitted. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | InventorySyncResult | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden |
409 | application/json | ErrorEnvelope | idempotency_in_progress, idempotency_key_reused |
422 | application/json | ErrorEnvelope | validation_failed |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
503 | application/json | ErrorEnvelope | dependency_unavailable |
Fields of the 200 answer
The shape is InventorySyncResult.
| Field | Type | Required | Description |
|---|---|---|---|
finished_at | Timestamp | yes | |
object | "inventory_sync" | yes | |
providers | array of InventorySyncProviderResult | yes | |
started_at | Timestamp | yes |