Execute import and persist data
Executes the import to create and update entities in the database. This is the final step that actually persists your data.
What this does:
- Queues the import for background processing (avoids timeout for large files)
- Returns immediately with queued status
- Processes all rows asynchronously in the background
- Creates new entities and updates existing ones based on lookup fields
- Updates import status and progress statistics in real-time
Before Executing: ⚠️ Important: Always run a dry-run first to preview results!
- Verify mappings are correct using GET /{importId}
- Run POST /{importId}/dry-run to preview what will happen
- Review dry-run results and fix any issues
- Only execute when you’re confident the results are correct
How to Track Progress:
- Call this endpoint to start execution (returns immediately)
- Poll GET /{importId} to check status and progress
- Monitor these fields:
status: Current import statusprocessedEntities/totalToProcess: Progress percentagetotalCreatedEntities/totalUpdatedEntities/totalSkippedEntities: Final counts
Import Status Values:
Uploaded: Import created, ready for executionProcessing: Import is currently running (checkprocessedEntitiesfor progress)Completed: Import finished successfully (see final statistics)Failed: Import encountered errors (check error message if available)
Processing Performance:
- Processing time depends on row count and entity complexity
- Typically 1-5 seconds per 100 rows
- Large imports (1000+ rows) may take several minutes
- Progress is updated in real-time, so you can monitor via GET /{importId}
What Happens During Execution:
- Each row is processed sequentially
- System uses lookup fields to find existing records
- If found: record is updated with new values
- If not found: new record is created
- Validation errors cause rows to be skipped
- Dependencies are automatically created (e.g., Organization before OrganizationMember)
POST
/imports-management/{importId}/executeAuthorization
AuthorizationOAuth2 access token · headerrequiredScopes:
api:writeor
AuthorizationBearer token (JWT) · headerrequiredPath parameters
importIdstringrequiredUnique identifier of the import
Responses
200Import queued for execution
importIdstringrequiredThe import ID (UUID) that was queued. Use this ID with GET /{importId} to check status and monitor progress during background processing.
messagestringrequiredHuman-readable message explaining the import status and next steps for tracking progress
queuedbooleanrequiredIndicates whether the import has been successfully queued for background processing. If true, the import will start processing asynchronously. Use GET /{importId} to monitor progress.
400Import already processing or invalid state
401Unauthorized - Invalid or missing authentication token
403Forbidden - Insufficient API scopes or permissions
404Import not found
Request
curl -X POST "https://leadtime.app/api/public/imports-management/d2ee76e3-95d7-4b98-8d5d-98dc1fb79364/execute" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"const response = await fetch("https://leadtime.app/api/public/imports-management/d2ee76e3-95d7-4b98-8d5d-98dc1fb79364/execute", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
});import requests
response = requests.post(
"https://leadtime.app/api/public/imports-management/d2ee76e3-95d7-4b98-8d5d-98dc1fb79364/execute",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
},
)Response
{
"importId": "d2ee76e3-95d7-4b98-8d5d-98dc1fb79364",
"message": "Import has been queued for processing. Use GET /{importId} to check status.",
"queued": true
}Import already processing or invalid state
Unauthorized - Invalid or missing authentication token
Forbidden - Insufficient API scopes or permissions
Import not found