Skip to main content

Grounding

Batch-check live availability for a set of items

POST
/projects/{projectId}/grounding/availability
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Path Parameters

projectId*string

Project UUID

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/projects/string/grounding/availability" \  -H "Content-Type: application/json" \  -d '{    "availability": {},    "item_ids": [      "string"    ]  }'
{
  "$schema": "/api/v1/schemas/GroundingAvailabilityOutputBody.json",
  "items": [
    {
      "$schema": "/api/v1/schemas/ResultItem.json",
      "availability": {
        "as_of": "2019-08-24T14:15:22Z",
        "next_open_slots": [
          "2019-08-24T14:15:22Z"
        ],
        "status": "string"
      },
      "item": {
        "$schema": "/api/v1/schemas/CatalogItem.json",
        "attributes": {
          "property1": null,
          "property2": null
        },
        "created_at": "2019-08-24T14:15:22Z",
        "currency": "string",
        "description": "string",
        "external_ref": "string",
        "is_active": true,
        "item_id": "string",
        "item_type": "string",
        "kb_node_id": "string",
        "media": [
          {
            "gcs_uri": "string",
            "kb_document_id": "string",
            "kind": "string"
          }
        ],
        "name": "string",
        "parent_item_id": "string",
        "price": 0.1,
        "price_unit": "string",
        "price_updated_at": "2019-08-24T14:15:22Z",
        "project_id": "string",
        "status": "string",
        "tenant_id": "string",
        "updated_at": "2019-08-24T14:15:22Z",
        "version": 0
      },
      "kb_snippets": [
        "string"
      ]
    }
  ]
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Get one item with live availability

GET
/projects/{projectId}/grounding/items/{itemId}
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Path Parameters

projectId*string

Project UUID

itemId*string

Catalog item UUID

Query Parameters

from?string

RFC3339 or YYYY-MM-DD

to?string

RFC3339 or YYYY-MM-DD

Response Body

application/json

application/problem+json

curl -X GET "https://loading/api/v1/projects/string/grounding/items/string"
{
  "$schema": "/api/v1/schemas/ResultItem.json",
  "availability": {
    "as_of": "2019-08-24T14:15:22Z",
    "next_open_slots": [
      "2019-08-24T14:15:22Z"
    ],
    "status": "string"
  },
  "item": {
    "$schema": "/api/v1/schemas/CatalogItem.json",
    "attributes": {
      "property1": null,
      "property2": null
    },
    "created_at": "2019-08-24T14:15:22Z",
    "currency": "string",
    "description": "string",
    "external_ref": "string",
    "is_active": true,
    "item_id": "string",
    "item_type": "string",
    "kb_node_id": "string",
    "media": [
      {
        "gcs_uri": "string",
        "kb_document_id": "string",
        "kind": "string"
      }
    ],
    "name": "string",
    "parent_item_id": "string",
    "price": 0.1,
    "price_unit": "string",
    "price_updated_at": "2019-08-24T14:15:22Z",
    "project_id": "string",
    "status": "string",
    "tenant_id": "string",
    "updated_at": "2019-08-24T14:15:22Z",
    "version": 0
  },
  "kb_snippets": [
    "string"
  ]
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Query live inventory: hybrid KB search + structured catalog filters + availability

POST
/projects/{projectId}/grounding/query
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Path Parameters

projectId*string

Project UUID

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/projects/string/grounding/query" \  -H "Content-Type: application/json" \  -d '{}'
{
  "$schema": "/api/v1/schemas/QueryResponse.json",
  "as_of": "2019-08-24T14:15:22Z",
  "items": [
    {
      "$schema": "/api/v1/schemas/ResultItem.json",
      "availability": {
        "as_of": "2019-08-24T14:15:22Z",
        "next_open_slots": [
          "2019-08-24T14:15:22Z"
        ],
        "status": "string"
      },
      "item": {
        "$schema": "/api/v1/schemas/CatalogItem.json",
        "attributes": {
          "property1": null,
          "property2": null
        },
        "created_at": "2019-08-24T14:15:22Z",
        "currency": "string",
        "description": "string",
        "external_ref": "string",
        "is_active": true,
        "item_id": "string",
        "item_type": "string",
        "kb_node_id": "string",
        "media": [
          {
            "gcs_uri": "string",
            "kb_document_id": "string",
            "kind": "string"
          }
        ],
        "name": "string",
        "parent_item_id": "string",
        "price": 0.1,
        "price_unit": "string",
        "price_updated_at": "2019-08-24T14:15:22Z",
        "project_id": "string",
        "status": "string",
        "tenant_id": "string",
        "updated_at": "2019-08-24T14:15:22Z",
        "version": 0
      },
      "kb_snippets": [
        "string"
      ]
    }
  ],
  "knowledge": [
    {
      "content": "string",
      "label": "string",
      "node_id": "string",
      "score": 0.1
    }
  ]
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}