> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cortex-labs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Bring API data into the world model

> Bring data from your own API into a workspace by identifying the request parameters, declaring the returned records and mapping those records to the workspace's domain schema. Kato can prepare each stage from your instructions.

Bring data from your own API into a workspace by identifying the request parameters, declaring the returned records and mapping those records to the workspace's domain schema. Kato can prepare each stage from your instructions.

## Before you begin

You need Vantage and Forge authoring access, permission to ingest into the target dataset and an Admin to save the API key. The workspace's pinned domain schema must contain the entity types and attributes you intend to use.

Gather the API documentation and a small permitted sample response. Keep credentials out of those materials.

## 1. Store your API key

Have an Admin save the key in **Console → Secrets** and confirm its status is **Tenant key**. Record the secret name for Kato.

Confirm how the API expects the credential, such as a bearer token or named header. Do not assume that the stored value includes an authentication prefix.

Follow [Connect an API with your own key](https://docs.cortex-labs.ai/vantage/bring-in-data/connect-api-with-your-key.md) for secure setup and testing.

## 2. Identify the parameters

Use the API documentation to complete a request checklist before writing the bundle:

| Part of the request | Identify |
| - | - |
| Endpoint | HTTPS host, path and HTTP method. |
| Authentication | Secret name and documented header or other credential mechanism. |
| Query and body | Required fields, types, accepted values and defaults. |
| Scope | Filters such as dates, area or record category, where supported. |
| Detail | Requested time or spatial resolution and any aggregation. |
| Pagination | Page size, cursor or offset and the end-of-results signal. |
| Limits | API rate limits and a small first-run boundary. |
| Response | Record location, stable identifier, timestamps, positions, attributes and units. |

Ask Kato:

> Using \[API documentation] and \[permitted response sample], list the required and optional parameters for \[endpoint]. Show where each goes, its type and allowed values. Identify pagination, time zones, resolution, units and stable IDs. Flag anything the documentation does not establish. Propose a small first request. Do not create resources or run it yet.

Review the proposal against the documentation. Choose resolution that preserves the detail your analysis needs; a mapping cannot recover time or position precision already lost during collection.

## 3. Draft the bundle and record declaration

> Draft an Ingest bundle for the reviewed API request. Read the credential from \[secret name]. Expose the agreed non-sensitive filters as bundle parameters. Preserve stable IDs, source timestamps, positions and units in the output records. Declare their fields and natural keys, including the source time field and observations where appropriate. Emit text fragments. Show the code, descriptor and one expected record before creating or publishing anything.

Inspect one expected record beside the API response. Check coordinate order explicitly. Preserve supplied times with their time zone and real precision. Leave missing information explicit.

Create and publish the bundle only after review. Record its identifier and version.

## 4. Create or select the destination dataset

> Use \[test dataset] for this integration in \[workspace]. Confirm which collection attaches it to the workspace and show its security level. If a new dataset is needed, propose it first.

Check that the intended workspace reaches the dataset. A dataset and its eligible results can reach multiple workspaces through collections; inspect that reach before ingestion.

## 5. Map the records

Ask Kato to inspect the workspace's pinned domain-schema version. Choose existing entity types, relationship types and attributes that match the meaning of the source.

Prepare a mapping table:

| Source information | Mapping decision |
| - | - |
| Stable ID | The source item identity used consistently across runs. |
| Name | The field naming the entity. |
| Position | The field and documented coordinate order. |
| Attributes | Declared schema attributes, with their units. |
| Relationships | Declared relationship types and valid endpoints, when present. |
| Event time | The field describing when the observation applies. |
| Precision | The actual source precision. |

Then ask:

> Draft a world-model mapping over \[bundle]'s record declaration, using input family script.record and \[workspace]'s pinned domain schema. Map \[source fields] to \[declared types and attributes]. Use \[time field] for event time and \[source precision] for precision. Show the field paths and explain any unmapped fields. Do not invent missing values, publish or attach it yet.

Review each field path. For an instant event time, the mapping uses `event_time` with kind `instant` and the source field path. Precision is a separate top-level mapping parameter.

Check that the workspace's pinned schema contains the selected types. An Owner must deliberately change that pin if another published schema version is needed.

## 6. Publish, attach and test

After review, ask Kato to publish the mapping and read its published version back. Confirm event time, precision and the selected types.

Attach the published mapping to the dataset. Inspect the binding's processing state. Create a job targeting that dataset, pinned to the reviewed bundle version and configured with your chosen parameters. Keep triggers disabled.

Run an isolated job test. Inspect accepted and rejected records, source IDs, timestamps, positions and the proposed checkpoint. The test writes no production records. It checks collection; verify the attached mapping separately in the next stage.

## 7. Run a small sample and inspect the world model

Start one bounded production run when you are satisfied with the test.

1. Inspect the actual run's accepted, failed and skipped input.
2. Open the dataset's **Fragments** page and check representative records.
3. Inspect binding progress and any pending, failed or rejected processing.
4. Open a resulting entity in the workspace's **World Model** and follow its mention to the source fragment.
5. Check position, event time, precision and attributes against the source.
6. Check the map and time filter using observations with known positions and times.

Compare counts with the actual production run and its processing rules. A live API can change between test and production, so identical counts are not guaranteed.

Newly produced entries still require review. Correct the mapping or source when needed, publish a revised version and inspect the resulting processing before increasing collection.

## Resolve gaps

* **No records:** inspect authentication, parameters, scope and pagination.
* **Records but no world-model results:** inspect dataset reach, mapping attachment and processing status.
* **Types under Other:** compare the mapped types with the workspace's pinned schema.
* **Missing time or position:** inspect the original response, record declaration and mapping paths.
* **Duplicates:** check stable source IDs and natural-key choices.

For ongoing collection, continue with [Run ingestion and inspect processing](https://docs.cortex-labs.ai/vantage/bring-in-data/run-ingestion.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.