# Imports API

2 operations under /api/v1. Errors are RFC 9457 problem+json with a stable `code` field. The complete schemas are in https://nebulactrl.com/api/v1/openapi.json.

## POST /imports/coolify/apply

Import from Coolify

Creates the projects, environments, services and managed databases of a Coolify instance as staged changes: services, volumes, variables (secrets marked), domains and links. The request must match a plan without blockers; the plan is recomputed from Coolify, so the response never depends on a stale review. Database and volume data is not copied. With `deploy: true` the new services are deployed (needs deployments:write); otherwise review them and deploy from the staged bar.

Authentication: session cookie or `Authorization: Bearer nct_…` token.

Parameters:
- `Idempotency-Key` (header, string): Client-chosen key (<=255 chars). A retry with the same key replays the original response for 24 hours.

Request body (application/json, required): CoolifyApplyRequest
  - `choices` (CoolifyChoices, required)
  - `deploy` (boolean)
  - `serverId` (string, required)
  - `source` (CoolifySource, required)

Response 201: Created (CoolifyApplyResult)
  - `deployments` (string[] | null, required)
  - `followups` (string[] | null, required)
  - `projects` (CoolifyAppliedProject[] | null, required)
  - `rewrites` (CoolifyPlanRewrite[] | null, required)
  - `services` (CoolifyAppliedService[] | null, required)
  - `warnings` (string[] | null, required)
Errors: 401 Unauthorized; 403 Forbidden; 409 Conflict; 422 Unprocessable Entity; 500 Internal Server Error

## POST /imports/coolify/plan

Review an import from Coolify

Reads a Coolify v4 instance with the given API token (read and read:sensitive) and returns how every project, environment, application and database would be imported: the service source and settings, domains, variables by key (secrets flagged, values never returned), references rewritten to other imported resources, what is not supported, and the follow-up steps (data is never copied). `choices` change the defaults; send the same body again to see the effect. Nothing is written and the Coolify token is used for this request only. Needs projects:write and an unrestricted token, because the server connects to the given address with the credential.

Authentication: session cookie or `Authorization: Bearer nct_…` token.

Request body (application/json, required): CoolifyPlanRequest
  - `choices` (CoolifyChoices, required)
  - `serverId` (string)
  - `source` (CoolifySource, required)

Response 200: OK (CoolifyPlan)
  - `blockers` (string[] | null, required)
  - `checks` (CoolifyCheck[] | null, required)
  - `coolifyVersion` (string)
  - `followups` (string[] | null, required)
  - `installable` (boolean, required)
  - `projects` (CoolifyPlanProject[] | null, required)
  - `registries` (CoolifyPlanRegistry[] | null, required)
  - `rewrites` (CoolifyPlanRewrite[] | null, required)
  - `totals` (CoolifyTotals, required)
  - `unsupported` (CoolifyPlanUnsupported[] | null, required)
  - `warnings` (string[] | null, required)
Errors: 401 Unauthorized; 403 Forbidden; 422 Unprocessable Entity; 500 Internal Server Error
