Site Import API Reference
Complete reference for the Site Import REST API. See Site Import API guide for usage examples.
Authentication
All endpoints require authentication via one of:
| Method | Header | Use case |
|---|---|---|
| API Key | Authorization: Bearer <key> | Scripts and automation |
| API Key (alt) | x-api-key: <key> | Legacy support |
| Session | Cookie-based | Dashboard UI |
POST /api/site-import
Create a site with all resources.
Request
{
"organizationId": "string (required)",
"name": "string (required)",
"domain": "string (optional)",
"database": {
"type": "mariadb | mysql | postgres | mongodb",
"name": "string",
"user": "string",
"password": "string"
},
"source": {
"type": "github | gitlab | docker | git",
"repo": "string (owner/name, for github/gitlab)",
"branch": "string (default: main)",
"buildPath": "string (default: /)",
"buildType": "dockerfile | nixpacks (default: dockerfile)",
"dockerImage": "string (for docker type)",
"githubId": "string (for github type)",
"gitlabId": "string (for gitlab type)",
"customGitUrl": "string (for git type)",
"customGitSSHKeyId": "string (for git type, optional)"
},
"envVars": { "KEY": "VALUE" },
"port": 80
}
Response 200
{
"importId": "string",
"status": "success",
"projectId": "string",
"applicationId": "string",
"databaseId": "string | undefined",
"databaseType": "string | undefined",
"databaseServiceHost": "string | undefined",
"domainId": "string | undefined"
}
Response 422 (partial failure)
Same shape as 200, with status: "partial" or status: "failed" and additional fields:
{
"importId": "string",
"status": "partial",
"errorMessage": "string",
"errorStep": "project_creation | database_creation | application_creation | domain_creation | deployment"
}
Response 401
{ "error": "Unauthorized" }
Response 400
{ "error": "Invalid input", "details": { "fieldErrors": {}, "formErrors": [] } }
POST /api/site-import/preview
Validate input without creating resources.
Request
Same body as POST /api/site-import.
Response 200
{
"valid": true,
"resources": {
"project": { "name": "string" },
"database": { "type": "string", "name": "string" },
"application": { "name": "string", "sourceType": "string", "buildType": "string" },
"domain": { "host": "string" }
},
"warnings": ["string"],
"errors": ["string"]
}
GET /api/site-import
List import history for the authenticated user's organization.
Query Parameters
| Param | Type | Default | Description |
|---|---|---|---|
limit | number | 50 | Max results (1-100) |
offset | number | 0 | Pagination offset |
Response 200
Array of import records.
GET /api/site-import/:id
Get a single import record by ID.
Response 200
Full import record including inputConfig, status, resource IDs, and error details.
Response 404
Import not found or belongs to a different organization.
tRPC Endpoints
The same functionality is available via tRPC for use from the dashboard or TypeScript clients:
| Procedure | Type | Input |
|---|---|---|
siteImport.import | mutation | Same as POST body |
siteImport.preview | query | Same as POST body |
siteImport.list | query | { limit?, offset? } |
siteImport.get | query | { siteImportId } |
siteImport.retry | mutation | { siteImportId } — idempotent, updates record in-place |
siteImport.delete | mutation | { siteImportId, rollbackResources? } — delete record, optionally rollback resources |
Import Statuses
| Status | Description | Available Actions |
|---|---|---|
pending | Import is in progress | Wait |
success | All resources created, deployment triggered | Delete record |
partial | Some resources created before failure | Retry, Rollback, Delete |
failed | No resources created | Retry, Delete |
success means resources were provisioned and deployment was triggered. The build and deploy are asynchronous — check the application's deployment logs for build status.