API Import Schedules

API Import Schedules

An API import schedule pulls records from an external system's API into a registration, automatically and on a recurring schedule. Instead of a staff member exporting a spreadsheet from another system and uploading it by hand, the records are fetched and imported on a day and at a time that suits the organisation.

A schedule does not move the data by hand. It decides which API to call, which registration receives the records, how the API fields map onto the registration's questions, when the import runs, and how the import knows where it left off last time. Each run only imports the records that are newer than the ones already stored — importing the same record twice is not possible.

API import schedules are useful when:

  • Customer registrations live in another system and need to appear in the survey every night, ready for staff the next morning.
  • A partner database publishes new customers through an API, and they need to be synchronised weekly.
  • A system exposes registration records that should be refreshed daily so questionnaires always work on current data.
  • A one-off historical import is needed before a project starts — the same mechanism that syncs new records can also backfill older ones.

Every run imports records as registration rows, exactly as if they had been created or uploaded by hand. Registration hierarchies are maintained automatically: values that belong in the registration's lookup tables are created when they are new, so a record never fails because its country, region or category is not yet in the list.

 

How an API import schedule works

An API import schedule is defined by the following settings:

Setting Purpose
Name A label for the schedule, shown in the list.
Report type Set to API import.
Registration The registration definition that receives the imported records. The API fields are mapped onto this registration's questions.
API config A JSON block describing the API call: the URL and method, authentication, paging, which field orders the records, and how each API field maps to a registration question.
Frequency Daily, weekly or monthly.
Send time and timezone The time of day the import runs, and the timezone that time refers to.
Active Whether the schedule runs at all. An inactive schedule is kept but does not import.

Unlike report schedules, an API import sends nothing by email — there are no recipients, subject or email template. The fields for those are not shown. The page that manages the schedules is the Scheduled Reports page, the same page used for emailed reports; import schedules appear in the same list.

 

How the incremental import works

The import is incremental: each run asks the API only for records newer than the ones already imported. This is done with a cursor — a field on every API record that increases over time, such as a sequential id, a record number or a modification timestamp.

  • Before each run, the system finds the largest cursor value already stored in the registration's data. That value is sent to the API as the start after parameter (for example min_id), so the API only returns newer records.
  • Records whose identity is already stored are skipped — the deduplication key is checked against the existing data, so a record can never be imported twice, even if pages overlap.
  • The resume point lives in the imported data itself, not in the schedule. Deleting imported rows lowers the resume point, so the next run fetches them again. The Last imported cursor field shown in the dialog is only a progress display; it does not control where the next run starts.
  • Records that lack a required value are not imported. A record is also dropped when a question marked required in the registration has no value after mapping, compose and static values are applied, or when a value for a lookup-table question cannot be resolved and the configuration says to skip it.

Because the cursor only moves forward, an import that started at a high value cannot reach records below it on its own. To backfill earlier records, use the Run button: it asks for an optional Start from value before running. Entering a lower cursor value re-fetches everything from that point upward — already imported records are skipped by the deduplication key, so only the missing ones are added. Leaving the field empty performs a normal run.

 

The list of schedules

The Scheduled Reports page shows one row per schedule. Each row summarises the schedule without opening it:

  • Name. The label the user chose for this schedule.
  • Report. For import schedules this shows the registration the records are imported into.
  • Schedule. How often the import runs. For weekly schedules it includes the weekday; for monthly schedules the day of the month.
  • Time. The time of day and time zone the import runs.
  • Next run. The date the schedule is next due.
  • Last run. The date the schedule last ran, so the user can tell at a glance whether the import is running.
  • Active. A checkbox that shows whether the schedule is currently running. The user can clear it to pause the schedule without deleting it.
  • Actions. A pencil to edit the schedule, and a bin to delete it.

If there are no schedules yet, the page shows a short message and the Add button.

 

Adding a schedule

Pressing the Add schedule button at the top of the page opens a dialog. The same dialog is used to edit an existing schedule, pre-filled with its current settings.

The fields in the dialog are described below in the order they appear.

1. Name

A label for the schedule, used in the list. Choose something that describes what is imported, such as Nightly customer import or Daily customer sync.

2. Report type and Registration

Choose API import as the report type. Next to it, the dialog asks which registration the records are imported into. The registration definition supplies the questions the API fields are mapped onto, the required-field rules each record must satisfy, and the lookup tables that resolve values such as country or region names.

3. API config

A JSON block describing the API call and the field mapping. A working starting point is filled in automatically when the report type is selected; the user edits it to match the external API. The keys are:

Key Purpose
request The API call itself: url, method (GET or POST), fixed headers and fixed query parameters.
auth How the call is authenticated: none, basic (username and password), bearer (token), apikey-header or apikey-query (name and value).
mapping The heart of the import: each entry maps an API field name to a question name in the registration — for example "customer_name": "Customer name". The value is stored in the imported row under that question. Every question the registration requires must receive a value through mapping, compose or a static value, or records are dropped as incomplete.
cursor How the import resumes. responseField is the record field that orders the data (it must also be a key of mapping, so the value is stored and can be found again). requestParam is the parameter sent to the API as the start-after value. orderParam and orderValue ask the API to sort ascending. initialValue is an optional floor for the very first run.
paging How large result sets are fetched: type is page (page number), offset or none, with the matching parameter names and a page limit.
recordsPath Where the records live inside the JSON response, for example data or result.items. Leave it out when the response itself is already the list of records.
dedupFields The fields that identify a record. Their values are compared against the stored data and matching records are skipped. Defaults to the cursor field; use several fields (for example customer id plus email) when the cursor alone does not identify a record.
lookup Optional per-field override: an API field's value is resolved against a specific registration lookup table instead of the table bound to its mapped question.
static Constant values merged into every imported record when the API supplies nothing for that question — for example a fixed source label or region.
compose Builds a question's value from several raw record fields using {field} placeholders — for example "Customer name": "{first_name} {last_name}". The referenced fields do not need to be in the mapping. A composed value is used when the record supplies no mapped value for the question, falls back to static when the rendered text is empty, and resolves through registration lookup tables like a mapped value — so a composed customer name or region is created in the lookup table when it is new. A question that appears in both mapping and compose uses the mapped value; the compose entry is ignored.
unresolved What to do when a lookup-table value does not exist yet: create (the default) adds it to the table so the record imports, skip stores an empty value so required questions drop the record instead.

A typical configuration looks like this:

{
  "request": {
    "method": "GET",
    "url": "https://example.org/api/web/v1/customers",
    "headers": { "Accept": "application/json" }
  },
  "auth": { "type": "basic", "username": "WEB", "password": "..." },
  "cursor": {
    "responseField": "customer_id",
    "requestParam": "min_id",
    "orderParam": "sort",
    "orderValue": "customer_id asc",
    "initialValue": "0"
  },
  "paging": { "type": "page", "pageParam": "page", "limitParam": "limit", "limit": 500 },
  "recordsPath": "data",
  "dedupFields": ["customer_id", "email"],
  "mapping": {
    "customer_id": "Customer id",
    "address": "Address",
    "tel": "Tel",
    "email": "Email"
  },
  "compose": {
    "Customer name": "{first_name} {last_name}"
  },
  "unresolved": "create"
}

Below the editor the dialog validates the configuration as it is typed: errors (for example a missing URL, or a cursor field that is not in the mapping) block saving, while warnings (for example a mapped question that does not exist in the registration) are shown for review but do not block it. A hint also lists the question names available in the selected registration, so the mapping can be checked without opening the registration designer.

4. Last imported cursor

A read-only display of where the last run ended. It is informational only: each run actually resumes from the largest cursor value found in the imported data itself, so deleting imported rows re-fetches them on the next run.

5. Frequency

How often the import runs: daily, weekly or monthly. When weekly is selected, the dialog shows a weekday picker; when monthly is selected, a day-of-month picker.

6. Send time and timezone

The time of day the import runs, and the timezone that time refers to — for example 04:00 in the organisation's own timezone, so the new records are present before field staff start work.

7. Active

A checkbox at the bottom of the dialog. When ticked, the schedule is live and imports on its next due date. When unticked, the schedule is kept in the list but does not run.

 

Saving, testing and running

At the bottom of the dialog, the user has four buttons.

Cancel

Close the dialog without saving. Any changes are discarded.

Test

Fetch one page from the API without importing anything. The result shows the effective cursor value, how many records the API returned, how many of them are new, a sample of the field names so the mapping can be checked, and any problems found in those records — for example a required question the API leaves empty. Test is only available after the schedule has been saved once, and it is the recommended first step whenever the configuration changes.

Run

Execute the import immediately instead of waiting for the next due date. A small dialog asks for an optional Start from value: leave it empty for a normal incremental run, or enter a cursor value to re-fetch everything from that point upward. Already imported records are skipped by the deduplication key, so Start from is the way to backfill records that were missed or that predate the first import. Up to 1,000 records are imported per manual run.

Save

Save the schedule. Save is disabled until a registration is chosen and the API config passes validation. If the server rejects any value, the dialog shows the field-level error and does not close.

 

Editing, pausing and deleting a schedule

From the list, the user can:

  • Pause a schedule by clearing the Active checkbox in the row. The schedule stays in the list; it just will not run on its next due date. Ticking it again resumes the schedule.
  • Edit an existing schedule with the pencil icon. The dialog opens with all the settings pre-filled from that schedule.
  • Delete a schedule with the bin icon. A confirmation prompt appears first. Deleting a schedule does not delete the imported registrations; only the automated import is removed.

If a run fails — for example the API is unreachable or returns an error — the failure is recorded on the schedule and shown in the list as the last result, so a broken import does not go unnoticed.

 

Basic examples

Example 1: nightly customer registration import

An organisation keeps its customer register in a central system that exposes the records through an API. Staff need the new customers in the survey every morning.

  1. On the Scheduled Reports page, click Add schedule.
  2. Name: Nightly customer import.
  3. Report type: API import.
  4. Registration: the customer registration definition.
  5. API config: set the API's URL and credentials, map the API fields onto the registration questions (customer id, address, tel, email), build the customer name from the two name fields with "compose": {"Customer name": "{first_name} {last_name}"}, set the cursor field to the customer id, and the dedup fields to customer id plus email.
  6. Frequency: Daily.
  7. Send time: 04:00. Timezone: the organisation's local timezone.
  8. Active: ticked.
  9. Save.
  10. Reopen the schedule and press Test. Check that the sample fields match the mapping and that no required questions are missing. If the preview looks right, press Run and leave Start from empty for a first incremental import.

From now on, new customers appear in the registration overnight. If the API later adds a customer whose region is not yet in the registration's lookup table, the value is created automatically so the record imports anyway.

Example 2: backfilling earlier records

The first import started at customer id 8,001, but the register also contains older customers below that number. Because the cursor only moves forward, a normal run will never reach them.

  1. Open the import schedule with the pencil icon.
  2. Press Run.
  3. In the Start from field, enter the lowest customer id to import, or the start of the register.
  4. Confirm with Run. The import fetches every record from that point upward; the already imported customers are skipped by the deduplication key and only the older, missing ones are added.

After the backfill, no change is needed: the next scheduled run resumes automatically from the largest stored cursor value, and incremental sync continues as before.

Example 3: combining fields with compose

The customer API sends first_name and last_name as separate fields, but the registration has a single Customer name question. Compose joins them:

  "compose": {
    "Customer name": "{first_name} {last_name}"
  }
  1. Add the compose block to the API config. The fields inside the braces are raw API field names — they do not need to appear in the mapping.
  2. Do not also map a field to Customer name: when a mapped value exists it wins and the template is never used (the editor warns about this).
  3. If Customer name is bound to a lookup table, the composed text is resolved and created in the table like any mapped value — so {first_name} {last_name} and {last_name}, {first_name} would create two different entries. Keep the template consistent.
  4. Press Test to see the composed values and any "would create" lookup entries before running the import.

© Denkami 2026 | 18 Kapumpe Rd, Lusaka, Zambia | +260 962 401 869 | admin@denkami.com