Check the Status of Your CSV Imports

Learn how to get the status of your CSV imports using the (New) CSV Import API.

Employee App
Front Door Intranet
beta

CSV Imports is one of the easiest ways to import and sync user data into the Staffbase platform. Using the (new) CSV Import API makes it even easier to schedule automatic data syncs and keep your constantly evolving user database up to date.

In this article, we’ll look at how to check the status of your CSV imports using the (new)CSV Import API.

If you have frequent updates and want to streamline your import process, you can run a script to check the status of the update. This is helpful if you run parallel imports and want to check the status of each import in progress in order to monitor the import progress.

Prerequisites:

  • You have the (new) CSV Import enabled for your platform.
  • You have uploaded at least one CSV file using the (new) CSV Import API.
  • You have already created an API token with administrative access via the Staffbase Studio. Learn more.

Make a GET request to the endpoint /users/imports.

Example request
1curl -X 'GET' \
2 'https://exampleapp.staffbase.com/api/users/imports?limit=20' \
3 -H 'accept: application/json' \
4 -H 'Authorization: Basic NjVmYWI3NmIyNjc2ZDMzM2FmMDU2NmEyOk1vVntWclJfZUVTWGdrJE0tWn5oT3puVm5EXyt4WzUzTyExcndaK24zJjs5RFVBOUJXNiFocVtvUCtrNzFNS2s='
Example response
1{
2 "entries": [
3 {
4 "id": "64b0fbf58e05e970f88a2791",
5 "createdAt": "2023-07-14T07:40:37.478Z",
6 "fileName": "mariokart_user_export_2023-06-14.csv",
7 "fileSize": 2010,
8 "recordCount": 8,
9 "state": "CREATING_PREVIEW",
10 "owner": {
11 "ownerId": "645de133f3e49f6b7f78cfff",
12 }
13 }
14 ],
15 "nextCursor": "string",
16 "prevCursor": "string"
17}

In the response, you can see the status of the import in the parameter state.

The following states are available for your import:

Import StateDescription
DRAFTThe CSV file has been uploaded.
PREVIEW_PENDINGThe preview of the CSV file has been requested.
CREATING_PREVIEWThe preview creation of the CSV file has been initiated.
PREVIEW_READYThe preview creation of the CSV file has been successfully completed.
IMPORT_PENDINGThe import of the CSV file has been requested.
IMPORTINGThe import process has been initiated.
COMPLETEDThe import has been successfully completed.
CANCELLEDThe CSV import has been canceled, and the file has been removed.

You have found the status of the import. Now, you can use this endpoint to queue your requests and trigger them one after the other.