Setup Capyflow CSV import step by step

Before integrate Capyflow, you must have a Capyflow account with an active subscription. You also have to setup your first schema and create an importer linked to this schema.

The Capyflow”s api URL is https://api.capyflow.com

1. Generate your API key

Look at the authentication page

2. Request API for an import attempt

When your user want to import a file, create an import attempt with a POST request at the following url
/api/import-attempts/

The body must be:

FieldDescription
success_urlThe url where the user is redirected after a successful import
return_urlThe url where the user is redirected when the import is cancelled
importer_uuidThe importer uuid
metadataMetadata fields: {key_1:value, key_2:value}

and the response is an import attempt object with the following structure:

KeyDescription
idThe unique identifier for the import attempt
importerThe importer associated with the import attempt
schemaThe schema used for the import attempt
uuidThe unique identifier for the import attempt
importer_uuidThe unique identifier for the importer
urlThe URL for the import attempt portal
metadataMetadata fields: {key_1:value, key_2:value}
success_urlThe URL where the user is redirected after a successful import
return_urlThe URL where the user is redirected when the import is cancelled
stateThe current state of the import attempt. More details import attempt
created_atThe timestamp when the import attempt was created
updated_atThe timestamp when the import attempt was last updated

You now have to redirect your user to the url field value.

3. Prepare your backend webhook url

Capyflow will send a request to your webhook target url parametrized in your importer form in the dashboard. The request sent to your url is an import attempt object with a DATA_AVAILABLE state.

4. Pull the data

Use the importer_uuid value of the import attempt object sent to your webhook endpoint, to request the following paginated endpoint
/api/import-attempts/IMPORTER_UUID/pull/

The data, in the results field, is an array. Each items is a CSV row and have the structure of your schema (keys are the Internal name of your schema fields).

5. Finish the import

Once you pulled all your data, you can send a POST request to the
/api/import-attempts/IMPORTER_UUID/pull/finish/
endpoint in order to terminate the import attempt.

After that, the user is redirected to your success_url