---
title: "Export records to a reporting database"
site: admin
version: 1.11
versions: "all"
url: https://docs-new.servicely.ai/admin/1.11/integrations/export-to-a-reporting-database/
type: task
application: platform_integration
last_updated: 2026-10-18
commit: f37120b6b82b
---


Export records to your own database when you need trend, ageing or forecast reporting that runs outside Servicely. A nightly job reads the records changed that day through the REST API and loads them into the database your reporting tool reads.

<Image src="asset:screenshots/admin/integrations-export-to-a-reporting-database/image.png">Servicely feeding a customer database through the REST API once a day, 200 records per page, with a reporting tool reading the database.</Image>

## Before you begin

- You need the `administrator` role to create the System API token and the user it impersonates.
- Have a database in your own environment and a scheduler or ETL tool that can call a REST API. Setting these up, and the reporting tool, is outside Servicely.
- Choose a Servicely user for the export with read permission on every table you export. It needs no other role.

## Steps

<Steps>
  <Step>
    List the tables to export by their table names, not their labels. Incidents are `Incident`, problems `Problem` and requests `ITSMRequest`. Tables and fields added in your implementation start with `C_`, for example `C_FleetManagement`.
  </Step>
  <Step>
    Create a System API token that impersonates the export user. To limit it to the REST API, set **Allowed Scopes** to **REST API (v1)**.
  </Step>
  <Step>
    In Servicely, open the list of one table, filter it to the records updated today, and shift-click the copy button on the filter to copy the query.
  </Step>
  <Step>
    Build the request URL for each table from the query, a page size of 200 and a sort order:

    ```
    https://<instance>.servicely.ai/v1/Incident?query={"and":[{"fieldName":"UpdatedOn","operator":"=","value":"today()","displayValue":"Today"}]}&page_size=200&page=1&order_desc=CreatedOn
    ```
  </Step>
  <Step>
    In your ETL tool, request page 1, then the next page, until the `X-Result-More` response header is `false`.
  </Step>
  <Step>
    Insert or update each record in your database by its `id`, so a record changed twice is stored once.
  </Step>
  <Step>
    Schedule the job to run once every 24 hours, out of business hours.
  </Step>
  <Step>
    Connect your reporting tool to the database. Rename the field names to readable labels there, for example `AssignmentGroup` to "Assignment Group" and `C_BackgroundInformation` to "Background Information".
  </Step>
</Steps>

<Callout type="warning">
  Keep to 200 records a page and one run a day. More frequent or larger pulls add load to your Servicely instance during working hours.
</Callout>

## Result

After each run the database holds every record changed that day, and the reporting tool reads it without querying Servicely. The REST API returns field names as they are stored, so labels you renamed in the reporting tool stay readable across runs.

## Related

- [Query records and operators](page:api/rest/query-records)
- [Authentication methods for inbound integrations](page:integrations/inbound-authentication)
- [Reporting](page:reporting)
