---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://segmentstream.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Import existing records

Bring a CSV export or provider API into your workspace ontology. Preserve source IDs and relationships, make a repeated batch safe and reconcile the result.

## Choose where each row belongs

Put records people will edit, approve or act on in the ontology. For example, a company and its open tickets need record IDs and a relationship. A daily table of ticket counts for reporting fits a warehouse pipeline. A migration can use both. The write path for operational records is an ontology action.

[Records and actions](https://segmentstream.com/docs/records-and-actions)

[ ](https://segmentstream.com/docs/records-and-actions)· [Warehouse jobs and operational workflows](https://segmentstream.com/docs/jobs-and-workflows)

## Map IDs before importing

Take a small export with related rows, including an empty optional field and a record that was updated. Write down the source field, its type, the target property and the rule for a missing value. Keep the provider’s stable ID as text when its formatting matters. For multiple source accounts, include the source and account in the unique key.

- For a support ticket, use the company ID on the original ticket to find the matching company in the workspace. Link the ticket to that company. This keeps two companies with the same name distinct.
- A Telegram user ID can be imported when the source export or API actually supplies it. Store it separately from the display name or username. For a member who will act through the agent, follow the workspace’s sign-in or pairing flow to establish their permissions.
- Check an attachment and a historical change in the actual export. Preserve their original timestamp and author as source data if users need that history.

## Implement a repeatable batch action

Ask the coding agent to declare the unique key in the entity and write an import action that matches on that key. The Ontology SDK’s upsertMany accepts a unique property or declared compound unique index. Its summary reports created, updated and unchanged counts. Give the importing identity the specific action permission. Decide how to handle notifications or other effects when a row is replayed.

- Import parent records first. Match dependent rows through the saved source keys. Put unresolved references and duplicate keys in a report with their source IDs so someone can correct them.
- For a provider API, declare a connection and checkpoint the cursor after the batch commits. For a file, record the source filename and batch range so the same input can be replayed.

[Implement an import action with the Ontology SDK](https://segmentstream.com/docs/sdk/ontology)

[ ](https://segmentstream.com/docs/sdk/ontology)· [Provider connections](https://segmentstream.com/docs/connections)

## Reconcile a sample before the full import

Import a company and one of its support tickets into a preview. Open the imported ticket and follow its company link. Check that the company’s source ID matches the one on the original ticket. Import the same sample again and check that both records are unchanged and still linked. Then change the ticket’s title in the sample and import it again. The existing ticket should show the new title and still link to the same company.

- For the full run, compare distinct keys and counts by entity, source and status. Account for every rejected or intentionally skipped row. Compare a business total such as open-ticket count by owner.
- Keep the import result and rejected rows alongside the source export. Resume from the last successful batch and run the same comparisons on the final delta before cutover.

[Inspect the deployed workspace API](https://segmentstream.com/docs/api/workspace)

[ ](https://segmentstream.com/docs/api/workspace)· [Cut over the application](https://segmentstream.com/docs/migrate-an-existing-app)

[Read as Markdown ↗](https://segmentstream.com/docs/import-existing-records.md)
