Skip to content
Leadtime
English
Esc
navigateopen⌘Jpreview

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:

  1. Call this endpoint to start execution (returns immediately)
  2. Poll GET /{importId} to check status and progress
  3. Monitor these fields:
    • status: Current import status
    • processedEntities / totalToProcess: Progress percentage
    • totalCreatedEntities / totalUpdatedEntities / totalSkippedEntities: Final counts

Import Status Values:

  • Uploaded: Import created, ready for execution
  • Processing: Import is currently running (check processedEntities for 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}/execute
Authorization
AuthorizationOAuth2 access token · headerrequired
Scopes:api:write
or
AuthorizationBearer token (JWT) · headerrequired
Path parameters
importIdstringrequired
Unique identifier of the import
Responses
200Import queued for execution
importIdstringrequired
The import ID (UUID) that was queued. Use this ID with GET /{importId} to check status and monitor progress during background processing.
messagestringrequired
Human-readable message explaining the import status and next steps for tracking progress
queuedbooleanrequired
Indicates 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"
Response
{
  "importId": "d2ee76e3-95d7-4b98-8d5d-98dc1fb79364",
  "message": "Import has been queued for processing. Use GET /{importId} to check status.",
  "queued": true
}