Body
No request body is required.
Response
Unique ID of the import, used to retrieve the status
Status of the import (“WAITING_FOR_UPLOAD”, “IN_PROGRESS”, “COMPLETE”, or “FAILED”)
Presigned S3 Upload URL (valid for 1 hour)
curl --location --request POST 'https://api.safetykit.com/v1/import' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <api_key>'
{
"import_id": "import_01hexzqs3n8hx83psy4ernj2zz",
"import_status": "WAITING_FOR_UPLOAD",
"upload_url": "https://safetykit-batch-uploads-production.s3.us-west-2.amazonaws.com/import/53ee3a58-73c6-4b3d-9d57-e6fe277c8dba/01HEXZQW6B07FKNV1D8P2M7F4B?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=ASIAV3FEZKTSHU6LLIVX%2F20231111%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20231111T012532Z&X-Amz-Expires=3600&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEML..."
}
Uploading the Import File
After creating an import, you will need to upload a JSONL (JSON Lines) file to the provided pre-signed S3 URL. The format of the JSONL file is important for correct processing.
- The file must be in JSONL format (newline-delimited JSON).
- Each line must be a valid JSON object with two fields:
type (string): The type of data being imported
data (object): The actual data payload for this item
{"type": "user_profile", "data": {"user_id": "12345", "name": "John Doe", "email": "john@example.com"}}
{"type": "transaction", "data": {"transaction_id": "tx_001", "amount": 99.99, "currency": "USD"}}
{"type": "user_profile", "data": {"user_id": "67890", "name": "Jane Smith", "email": "jane@example.com"}}
Each line represents a separate record to import. The type field allows you to mix different types of data in a single import file.
Uploading the JSONL file
Here is an example of how to upload the JSONL file to the pre-signed S3 URL:
curl -X PUT -T "<Path to your JSONL file>" "<Your Pre-Signed URL Here>" -H "Content-Type: application/jsonl"
After uploading, the import will automatically begin processing. You can check the import status using the GET endpoint.