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
}
'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": [
{}
]
}
}Syncs
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.
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
}
'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": [
{}
]
}
}Requires an API key with the
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.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 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
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
Headers
Body
application/json
Response
Successfully pruned records
Was this page helpful?