Skip to main content
PATCH
/
records
/
prune
Prune records
curl --request PATCH \
  --url https://api.nango.dev/records/prune \
  --header 'Authorization: Bearer <token>' \
  --header 'Connection-Id: <connection-id>' \
  --header 'Content-Type: application/json' \
  --header 'Provider-Config-Key: <provider-config-key>' \
  --data '
{
  "model": "<string>",
  "until_cursor": "<string>",
  "variant": "<string>",
  "limit": 5000
}
'
{
  "count": 150,
  "has_more": true
}
Prunes synced records for a given connection and model using cursor-based pagination.

What is pruning?

Pruning empties the record payload while preserving the record metadata. This is useful for compliance requirements, ensuring Nango doesn’t hold onto your records data while maintaining the ability to track record state. The payload can be restored by re-syncing the data.
Pruning is not the same as marking a record as deleted from the external API. This endpoint prunes data from Nango’s cache only. It does not delete anything on the external API, and it is not the same as detecting a deletion from the source.If you need to tell your customers that a record was deleted on the external API while keeping its last-known payload in cache, use batchDelete or deleteRecordsFromPreviousExecutions in your sync functions instead.

Cursor behavior

Records are pruned up to and including the specified until_cursor value. Use the _nango_metadata.cursor value from the record you want to prune up to.

Response

The has_more field indicates whether there are potentially more records to prune. When true, make another request with the same until_cursor to continue pruning. When false, all records up to the cursor have been pruned.
{
  "count": 150,
  "has_more": true
}

Authorizations

Authorization
string
header
required

The secret key from your Nango environment.

Headers

Connection-Id
string
required

The connection ID used to create the connection.

Provider-Config-Key
string
required

The integration ID used to create the connection (aka Unique Key).

Body

application/json
model
string
required

The data model to prune records from

until_cursor
string
required

Prune all records up to and including this cursor. Use the cursor value from _nango_metadata.cursor of the record you want to prune up to.

variant
string

The variant of the model

limit
integer

The maximum number of records to prune in this request. Defaults to 1000.

Required range: 1 <= x <= 10000

Response

Successfully pruned records

count
integer
required

The number of records pruned in this request

Example:

150

has_more
boolean
required

Indicates if there are potentially more records to prune.

  • true: There may be more records that need pruning
  • false: All records up to the cursor have been pruned
Example:

true