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
}
'import requests
url = "https://api.nango.dev/records/prune"
payload = {
"model": "<string>",
"until_cursor": "<string>",
"variant": "<string>",
"limit": 5000
}
headers = {
"Connection-Id": "<connection-id>",
"Provider-Config-Key": "<provider-config-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'Connection-Id': '<connection-id>',
'Provider-Config-Key': '<provider-config-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({model: '<string>', until_cursor: '<string>', variant: '<string>', limit: 5000})
};
fetch('https://api.nango.dev/records/prune', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nango.dev/records/prune",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'until_cursor' => '<string>',
'variant' => '<string>',
'limit' => 5000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Connection-Id: <connection-id>",
"Content-Type: application/json",
"Provider-Config-Key: <provider-config-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nango.dev/records/prune"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"until_cursor\": \"<string>\",\n \"variant\": \"<string>\",\n \"limit\": 5000\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Connection-Id", "<connection-id>")
req.Header.Add("Provider-Config-Key", "<provider-config-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.nango.dev/records/prune")
.header("Connection-Id", "<connection-id>")
.header("Provider-Config-Key", "<provider-config-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"until_cursor\": \"<string>\",\n \"variant\": \"<string>\",\n \"limit\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nango.dev/records/prune")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Connection-Id"] = '<connection-id>'
request["Provider-Config-Key"] = '<provider-config-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"until_cursor\": \"<string>\",\n \"variant\": \"<string>\",\n \"limit\": 5000\n}"
response = http.request(request)
puts response.read_body{
"count": 150,
"has_more": true
}{
"error": {
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}
}Prune records
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.
Cursor behavior: Records are pruned up to and including the specified cursor.
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
}
'import requests
url = "https://api.nango.dev/records/prune"
payload = {
"model": "<string>",
"until_cursor": "<string>",
"variant": "<string>",
"limit": 5000
}
headers = {
"Connection-Id": "<connection-id>",
"Provider-Config-Key": "<provider-config-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'Connection-Id': '<connection-id>',
'Provider-Config-Key': '<provider-config-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({model: '<string>', until_cursor: '<string>', variant: '<string>', limit: 5000})
};
fetch('https://api.nango.dev/records/prune', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nango.dev/records/prune",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'until_cursor' => '<string>',
'variant' => '<string>',
'limit' => 5000
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Connection-Id: <connection-id>",
"Content-Type: application/json",
"Provider-Config-Key: <provider-config-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nango.dev/records/prune"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"until_cursor\": \"<string>\",\n \"variant\": \"<string>\",\n \"limit\": 5000\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Connection-Id", "<connection-id>")
req.Header.Add("Provider-Config-Key", "<provider-config-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.nango.dev/records/prune")
.header("Connection-Id", "<connection-id>")
.header("Provider-Config-Key", "<provider-config-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"until_cursor\": \"<string>\",\n \"variant\": \"<string>\",\n \"limit\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nango.dev/records/prune")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Connection-Id"] = '<connection-id>'
request["Provider-Config-Key"] = '<provider-config-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"until_cursor\": \"<string>\",\n \"variant\": \"<string>\",\n \"limit\": 5000\n}"
response = http.request(request)
puts response.read_body{
"count": 150,
"has_more": true
}{
"error": {
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"errors": [
{}
]
}
}environment:records:write scope. Learn more about API key scopes.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.batchDelete or trackDeletesStart/trackDeletesEnd in your sync functions instead.Cursor behavior
Records are pruned up to and including the specifieduntil_cursor value. Use the _nango_metadata.cursor value from the record you want to prune up to.
Response
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
An Environment API key from your Nango environment, or an Account API key for account-level endpoints.
Headers
The connection ID used to create the connection.
The integration ID used to create the connection (aka Unique Key).
Body
The data model to prune records from
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.
The variant of the model
The maximum number of records to prune in this request. Defaults to 1000.
1 <= x <= 10000Response
Successfully pruned records
Was this page helpful?