Skip to main content
POST
/
v1
/
schemas
/
check
import olira

olira.init(api_key="YOUR_API_KEY")
result = olira.check_schema(
    examples=[{"reading_value": 42, "unit": "lux"}],
    schema={
        "type": "object",
        "required": ["reading_value"],
        "properties": {"reading_value": {"type": "number"}},
    },
    mapping={
        "targets": [
            {"target_subtype": "heart_rate_data", "field_mappings": [{"target": "avg_bpm", "source": "reading_value"}]},
        ],
    },
)
print(result.ok)
POST /v1/schemas/check
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "examples": [{"reading_value": 42, "unit": "lux"}],
  "payload_schema": {
    "type": "object",
    "required": ["reading_value"],
    "properties": {"reading_value": {"type": "number"}}
  },
  "mapping": {
    "targets": [
      {"target_subtype": "heart_rate_data", "field_mappings": [{"target": "avg_bpm", "source": "reading_value"}]}
    ]
  }
}
SchemaCheckResult(
    ok=True,
    results=[
        SchemaCheckExampleResult(
            input={"reading_value": 42, "unit": "lux"},
            ok=True,
            mapped_events=[
                {"subtype": "heart_rate_data", "payload": {"avg_bpm": 42}, "metadata": {}, "idempotency_key": None},
            ],
            errors=[],
        ),
    ],
    error=None,
)
{
  "error": true,
  "status_code": 401,
  "error_type": "authentication_error",
  "message": "Could not validate credentials",
  "details": [
    {
      "type": "authentication_error",
      "message": "Could not validate credentials"
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}
{
  "error": true,
  "status_code": 403,
  "error_type": "authorization_error",
  "message": "Insufficient OAuth scope for this endpoint",
  "details": [
    {
      "type": "authorization_error",
      "message": "Insufficient OAuth scope for this endpoint"
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}
{
  "error": true,
  "status_code": 404,
  "error_type": "not_found_error",
  "message": "Patient not found",
  "details": [
    {
      "type": "not_found_error",
      "message": "Patient not found"
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}
{
  "error": true,
  "status_code": 422,
  "error_type": "validation_error",
  "message": "Request validation failed (1 error)",
  "details": [
    {
      "type": "missing",
      "message": "Field required",
      "field": "patient_id",
      "location": ["body", "patient_id"],
      "input_value": null
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}
{
  "error": true,
  "status_code": 429,
  "error_type": "server_error",
  "message": "Rate limit exceeded",
  "details": [
    {
      "type": "rate_limit",
      "message": "Too many requests; retry after backoff"
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}
{
  "error": true,
  "status_code": 500,
  "error_type": "internal_server_error",
  "message": "An internal server error occurred",
  "details": [
    {
      "type": "internal_server_error",
      "message": "An unexpected error occurred while processing your request"
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}
olira.check_schema(
    examples: list[dict],
    subtype: str | None = None,
    version: int | None = None,
    schema: dict | None = None,
    mapping: dict | None = None,
) -> SchemaCheckResult
Requires scope: api:org-config Pass subtype (optionally with version) to check a stored or still-pending spec, or pass schema/mapping inline to check a candidate before registering it at all. Runs the same org gate, pure mapping engine, and platform-catalog gate the live ingest route uses, so a green check genuinely predicts what logging would accept.

Parameters

examples
list[dict]
required
Sample payloads to run through.
subtype
str | None
default:"None"
Load the active (or pinned version) schema/mapping for this subtype as the baseline.
version
int | None
default:"None"
Pin a specific version instead of the active one.
schema
dict | None
default:"None"
Inline schema, overriding or replacing the stored one.
mapping
dict | None
default:"None"
Inline mapping, overriding or replacing the stored one.

Returns

SchemaCheckResult
ok
bool
True only if every example passed.
results
list[SchemaCheckExampleResult]
Per-example outcome.
results[].input
dict
The example payload.
results[].ok
bool
Whether this example passed.
results[].mapped_events
list[dict]
Produced platform events (subtype + payload), if mapping succeeded.
results[].errors
list[str]
Schema/mapping/platform-catalog errors, if any.

Raises

ExceptionWhen
AuthErrorHTTP 401 or 403 — invalid API key or insufficient OAuth scope for this endpoint.
ValidationErrorHTTP 400, 404, or 422 — malformed JSON, unknown patient, or validation failure (message includes response excerpt).
ServerErrorHTTP 409 (e.g. conflicting external identifier) or repeated 5xx after retries; includes status_code when applicable.
RateLimitErrorHTTP 429 — rate limited; check retry_after (seconds).
NetworkErrorConnection timeout, DNS failure, or read error after retries.
import olira

olira.init(api_key="YOUR_API_KEY")
result = olira.check_schema(
    examples=[{"reading_value": 42, "unit": "lux"}],
    schema={
        "type": "object",
        "required": ["reading_value"],
        "properties": {"reading_value": {"type": "number"}},
    },
    mapping={
        "targets": [
            {"target_subtype": "heart_rate_data", "field_mappings": [{"target": "avg_bpm", "source": "reading_value"}]},
        ],
    },
)
print(result.ok)
POST /v1/schemas/check
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "examples": [{"reading_value": 42, "unit": "lux"}],
  "payload_schema": {
    "type": "object",
    "required": ["reading_value"],
    "properties": {"reading_value": {"type": "number"}}
  },
  "mapping": {
    "targets": [
      {"target_subtype": "heart_rate_data", "field_mappings": [{"target": "avg_bpm", "source": "reading_value"}]}
    ]
  }
}
SchemaCheckResult(
    ok=True,
    results=[
        SchemaCheckExampleResult(
            input={"reading_value": 42, "unit": "lux"},
            ok=True,
            mapped_events=[
                {"subtype": "heart_rate_data", "payload": {"avg_bpm": 42}, "metadata": {}, "idempotency_key": None},
            ],
            errors=[],
        ),
    ],
    error=None,
)
{
  "error": true,
  "status_code": 401,
  "error_type": "authentication_error",
  "message": "Could not validate credentials",
  "details": [
    {
      "type": "authentication_error",
      "message": "Could not validate credentials"
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}
{
  "error": true,
  "status_code": 403,
  "error_type": "authorization_error",
  "message": "Insufficient OAuth scope for this endpoint",
  "details": [
    {
      "type": "authorization_error",
      "message": "Insufficient OAuth scope for this endpoint"
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}
{
  "error": true,
  "status_code": 404,
  "error_type": "not_found_error",
  "message": "Patient not found",
  "details": [
    {
      "type": "not_found_error",
      "message": "Patient not found"
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}
{
  "error": true,
  "status_code": 422,
  "error_type": "validation_error",
  "message": "Request validation failed (1 error)",
  "details": [
    {
      "type": "missing",
      "message": "Field required",
      "field": "patient_id",
      "location": ["body", "patient_id"],
      "input_value": null
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}
{
  "error": true,
  "status_code": 429,
  "error_type": "server_error",
  "message": "Rate limit exceeded",
  "details": [
    {
      "type": "rate_limit",
      "message": "Too many requests; retry after backoff"
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}
{
  "error": true,
  "status_code": 500,
  "error_type": "internal_server_error",
  "message": "An internal server error occurred",
  "details": [
    {
      "type": "internal_server_error",
      "message": "An unexpected error occurred while processing your request"
    }
  ],
  "timestamp": "2026-05-06T12:00:00+00:00"
}