Skip to content

Import/Export API

Comvi provides two ways to import and export translations: a multi-step web import flow (validate, review, commit) and a streamlined CLI-oriented flow. Both support JSON and i18next v4 formats.

Export translations from a project, filtered by locale, namespace, and status.

Export translations using a POST request with filtering options. Returns a structured JSON response.

POST /api/v1/projects/:projectId/keys/export
ParameterTypeRequiredDescription
projectIdintegerYesProject ID
FieldTypeRequiredDescription
keyIdsinteger[]NoExport only specific key IDs
localeCodesstring[]NoFilter by locale codes (all locales if omitted)
namespacesstring[]NoFilter by namespace names (all namespaces if omitted)
formatstringNoOutput format: json or i18next-v4 (default: json)
statusesstring[]NoFilter by status: translated, not_reviewed, not_translated
includeEmptybooleanNoInclude keys with no translation value (default: false)
structurestringNoKey structure: flat or nested (default: flat)
stylestringNoJSON formatting: pretty or minified (default: pretty)
Terminal window
curl -X POST \
-H "X-API-Key: tlk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"localeCodes": ["en", "uk"],
"namespaces": ["default"],
"format": "json",
"statuses": ["translated"],
"structure": "flat",
"style": "pretty"
}' \
https://api.comvi.io/api/v1/projects/1/keys/export
{
"data": {
"default": {
"en": {
"welcome.message": "Welcome to our app!",
"welcome.subtitle": "Get started in seconds"
},
"uk": {
"welcome.message": "Ласкаво просимо!",
"welcome.subtitle": "Почніть за секунди"
}
}
}
}

A simplified export endpoint designed for the Comvi CLI. Returns all translations grouped by namespace and locale.

GET /api/v1/projects/:projectId/export
ParameterTypeRequiredDescription
localesstringNoComma-separated locale codes
namespacesstringNoComma-separated namespace names
statusesstringNoComma-separated statuses
includeEmptybooleanNoInclude keys with no translation value
Terminal window
curl -X GET \
-H "X-API-Key: tlk_your_api_key" \
"https://api.comvi.io/api/v1/projects/1/export?locales=en,uk&namespaces=default"
{
"locales": ["en", "uk"],
"namespaces": {
"default": {
"en": {
"welcome.message": "Welcome to our app!",
"welcome.subtitle": "Get started in seconds"
},
"uk": {
"welcome.message": "Ласкаво просимо!",
"welcome.subtitle": "Почніть за секунди"
}
}
}
}
StatusErrorDescription
401UNAUTHORIZEDMissing or invalid authentication
403FORBIDDENNo permission to export from this project

The web import is a three-step process: validate, optionally re-validate after user edits, then commit.

Upload files for validation. Comvi detects file format, locale, namespace, and identifies any conflicts with existing translations.

POST /api/v1/projects/:projectId/keys/import/validate
ParameterTypeRequiredDescription
projectIdintegerYesProject ID
FieldTypeRequiredDescription
filesobject[]YesArray of file objects to validate
files[].filenamestringYesOriginal filename (used for format detection)
files[].contentstringYesFile content as string
files[].sizeintegerYesFile size in bytes
optionsobjectNoValidation options
options.maxFileSizeintegerNoMaximum allowed file size
options.maxTotalKeysintegerNoMaximum total keys to import
options.defaultConflictResolutionstringNoDefault conflict strategy: keep_existing or use_imported
options.allowNewLocalesbooleanNoAllow importing for locales not yet in the project
Terminal window
curl -X POST \
-H "X-API-Key: tlk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"files": [
{
"filename": "en.json",
"content": "{\"welcome.message\": \"Hello!\"}",
"size": 30
}
],
"options": {
"defaultConflictResolution": "use_imported"
}
}' \
https://api.comvi.io/api/v1/projects/1/keys/import/validate
{
"validationId": "val_abc123",
"files": [
{
"filename": "en.json",
"detection": {
"filename": "en.json",
"detectedLocale": "en",
"detectedNamespace": "default",
"confidence": 0.95,
"keyCount": 1,
"errors": [],
"warnings": []
},
"conflicts": [],
"isValid": true
}
],
"summary": {
"totalFiles": 1,
"totalKeys": 1,
"uniqueKeys": 1,
"totalConflicts": 0,
"validFiles": 1,
"invalidFiles": 0
},
"errors": [],
"warnings": []
}

After the user adjusts file-to-locale mappings in the UI, re-validate to detect new conflicts.

POST /api/v1/projects/:projectId/keys/import/revalidate
FieldTypeRequiredDescription
validationIdstringYesValidation ID from step 1
fileMappingsobject[]YesUpdated file-to-locale/namespace mappings
fileMappings[].filenamestringYesFilename
fileMappings[].localestringYesTarget locale code
fileMappings[].namespacestringNoTarget namespace
conflictResolutionsobject[]NoPre-resolved conflicts

Commit the validated import with conflict resolutions.

POST /api/v1/projects/:projectId/keys/import/commit
FieldTypeRequiredDescription
validationIdstringYesValidation ID from step 1
fileMappingsobject[]YesFile-to-locale/namespace mappings
conflictResolutionsobject[]YesResolved conflicts
options.dryRunbooleanNoSimulate import without writing data
options.progressTrackingIdstringNoID for tracking import progress via polling
Terminal window
curl -X POST \
-H "X-API-Key: tlk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"validationId": "val_abc123",
"fileMappings": [
{
"filename": "en.json",
"locale": "en",
"namespace": "default"
}
],
"conflictResolutions": [],
"options": {
"dryRun": false
}
}' \
https://api.comvi.io/api/v1/projects/1/keys/import/commit
{
"success": true,
"results": {
"added": 10,
"updated": 5,
"skipped": 0
},
"conflictsSummary": {
"total": 2,
"keepExisting": 1,
"useImported": 1
},
"details": [
{
"filename": "en.json",
"locale": "en",
"namespace": "default",
"added": 10,
"updated": 5,
"skipped": 0,
"errors": []
}
],
"errors": [],
"warnings": [],
"duration": 1250.5
}

For large imports, poll the progress endpoint to track status.

GET /api/v1/projects/:projectId/keys/import/progress/:trackingId
{
"status": "running",
"totalFiles": 5,
"processedFiles": 3,
"currentFile": "de.json",
"results": {
"added": 150,
"updated": 30,
"skipped": 0
},
"startedAt": "2025-01-16T14:00:00.000Z"
}

The CLI flow is a simpler two-step process designed for automation: validate, then commit.

POST /api/v1/projects/:projectId/import/validate
{
"namespaces": {
"default": {
"en": {
"welcome.message": "Hello!",
"welcome.subtitle": "Get started"
},
"uk": {
"welcome.message": "Привіт!"
}
}
}
}
POST /api/v1/projects/:projectId/import/commit
FieldTypeRequiredDescription
namespacesobjectYesTranslation data keyed by namespace, locale, key
options.conflictResolutionstringYeskeep_local, keep_server, or fail
options.createNamespacesbooleanNoCreate namespaces that do not exist
options.deleteOrphansbooleanNoDelete keys not present in the import data

StatusErrorDescription
400VALIDATION_ERRORInvalid import data or file format
401UNAUTHORIZEDMissing or invalid authentication
403FORBIDDENNo permission to import into this project
403LIMIT_EXCEEDEDImport would exceed translation key limit for the current plan