List opted-out people
curl --request POST \
--url https://api.datalegion.ai/utility/opt-outs \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"limit": 10000
}'import requests
url = "https://api.datalegion.ai/utility/opt-outs"
payload = { "limit": 10000 }
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({limit: 10000})
};
fetch('https://api.datalegion.ai/utility/opt-outs', 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.datalegion.ai/utility/opt-outs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'limit' => 10000
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"Content-Type: application/json"
],
]);
$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.datalegion.ai/utility/opt-outs"
payload := strings.NewReader("{\n \"limit\": 10000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
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.post("https://api.datalegion.ai/utility/opt-outs")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"limit\": 10000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalegion.ai/utility/opt-outs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"limit\": 10000\n}"
response = http.request(request)
puts response.read_body{
"legion_ids": [
"0b6e2f4a-3c1d-5e7f-8a9b-1c2d3e4f5a6b",
"5d8a1c3e-7f2b-5a4c-9e6d-2b3c4d5e6f7a"
],
"next_cursor": "pTq9vX2LwYc8nK3mR0sB7hJ4dF6gA1eZ_u5oN-iQ2yW9tE"
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Utilities
Opt-Out List API
List the legion_ids of every person who opted out of the sale of their information or asked to be deleted, so you can delete them from data you received from us. Free.
POST
/
utility
/
opt-outs
List opted-out people
curl --request POST \
--url https://api.datalegion.ai/utility/opt-outs \
--header 'API-Key: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
"limit": 10000
}'import requests
url = "https://api.datalegion.ai/utility/opt-outs"
payload = { "limit": 10000 }
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({limit: 10000})
};
fetch('https://api.datalegion.ai/utility/opt-outs', 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.datalegion.ai/utility/opt-outs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'limit' => 10000
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"Content-Type: application/json"
],
]);
$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.datalegion.ai/utility/opt-outs"
payload := strings.NewReader("{\n \"limit\": 10000\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Key", "<api-key>")
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.post("https://api.datalegion.ai/utility/opt-outs")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"limit\": 10000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalegion.ai/utility/opt-outs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"limit\": 10000\n}"
response = http.request(request)
puts response.read_body{
"legion_ids": [
"0b6e2f4a-3c1d-5e7f-8a9b-1c2d3e4f5a6b",
"5d8a1c3e-7f2b-5a4c-9e6d-2b3c4d5e6f7a"
],
"next_cursor": "pTq9vX2LwYc8nK3mR0sB7hJ4dF6gA1eZ_u5oN-iQ2yW9tE"
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}How It Works
When a person opts out of the sale of their information or asks to be deleted, we stop delivering them from then on. Data you already received from us may still hold them. This endpoint lists thelegion_id of every such person, so you can delete them from your copy.
The list holds legion_id values only, never names or contact details. It also lists the legion_id values a person had before records were merged or split, so a person you received under an older legion_id is on the list too. When a record is split into two people, its legion_id is listed, though one of the two may keep it: delete what you hold under it all the same. A record we deliver to you under that legion_id after it was listed is the person who kept it, and you may use it.
The list is free, available to any API key, and rate limited to 60 requests per minute.
Reading the Whole List
The list pages the way Person Search does: sendlimit, then pass each page’s next_cursor as cursor until next_cursor is null. The list comes in ascending order. The cursor is opaque: send it back as you received it.
curl -X POST "https://api.datalegion.ai/utility/opt-outs" \
-H "API-Key: $DATALEGION_API_KEY" \
-H "Content-Type: application/json" \
-d '{"limit": 10000}'
curl -X POST "https://api.datalegion.ai/utility/opt-outs" \
-H "API-Key: $DATALEGION_API_KEY" \
-H "Content-Type: application/json" \
-d '{"limit": 10000, "cursor": "NEXT_CURSOR"}'
limit sets how many legion_id values a page holds, from 1 to 10,000 (default 1,000). Like Person Search, the endpoint also takes the same fields as query parameters on a GET.
What You Need to Do
If you keep data you received from us, our Acceptable Data Use Policy requires you to:- Read the whole list at least every 45 days
- Within 45 days of a
legion_idappearing on the list, delete that person’s data you received from us, from every copy you hold - Keep the
legion_iditself only to make sure you never use that person’s data again
legion_id, the identifier every record we deliver carries. Store it beside the data you keep.Body
application/json
Request model for the opt-out list: a page, paged as Search pages (limit, then next_cursor as cursor).
Response
Success - one page of opted-out legion_ids
One page of opted-out person records.