---
title: "Import Namespace"
method: POST
path: "/api/agent-data/namespaces/import"
tags: ["agent-data"]
---

# Import Namespace

`POST /api/agent-data/namespaces/import`

## Request

- Base URL: `https://app.thinqos.com` (the document declares no server; this is the origin it was published from)
- URL: `https://app.thinqos.com/api/agent-data/namespaces/import`
- Auth: none declared

Import a database from its SQL export into an environment you own (TOS-7356).

The file is parsed against the export's own narrow grammar and never run:
its tables are recreated through schema_apply (so the new database has a
migration log, and thinqOS, not the file, sets its row level security and
grants), then its COPY data is loaded into those tables only. Anything
else in the file (functions, extensions, other schemas, SET, DO blocks,
...) is refused with a 400 naming the statement. Same authority as the
export: the environment's owner or a platform admin.

## Request body

- ImportNamespaceIn
  - `environment_id` string, required
  - `sql` string, required
  - `name` string, nullable
  - `parent_library_id` string, nullable

## Response `201`

Successful Response

- ImportNamespaceOut
  - `id` string, required
  - `name` string, required
  - `environment_id` string, required
  - `environment_name` string, required
  - `library_id` string, nullable, required
  - `tables` string[], required
  - `rows` object, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/thinqos/apis/thinqos-api.md) · [All operations](https://skmtc.dev/thinqos/apis/thinqos-api/llms.txt) · [OpenAPI document](https://skmtc.dev/thinqos/apis/thinqos-api/revisions/ce2c2ce318b1?raw)
