> ## Documentation Index
> Fetch the complete documentation index at: https://www.datalegion.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.

## 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 the `legion_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](https://www.datalegion.ai/docs/api-reference/person-search.md) does: send `limit`, 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.

```bash theme={"dark"}
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](https://www.datalegion.ai/legal/acceptable-data-use#opted-out-people) requires you to:

1. Read the whole list at least every 45 days
2. Within 45 days of a `legion_id` appearing on the list, delete that person's data you received from us, from every copy you hold
3. Keep the `legion_id` itself only to make sure you never use that person's data again

Match on `legion_id`, the identifier every record we deliver carries. Store it beside the data you keep.


## OpenAPI

````yaml POST /utility/opt-outs
openapi: 3.1.0
info:
  title: Data Legion API
  description: API for enriching, searching, and discovering person and company data
  version: 1.0.0
servers:
  - url: https://api.datalegion.ai
security:
  - APIKeyHeader: []
paths:
  /utility/opt-outs:
    post:
      tags:
        - utility
      summary: List opted-out people
      description: >-
        Every legion_id of a person who opted out of the sale of their
        information or asked to be deleted, with the legion_ids they had before
        records were merged or split, in ascending order, a page at a time.
        Delete these people from data you received from us; read the whole list
        at least every 45 days. Page as Search does: send `limit`, then each
        page's `next_cursor` as `cursor` until it is null (GET or POST). Free.
        Rate limited to 60 requests per minute.
      operationId: list_opt_outs_utility_opt_outs_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OptOutsRequest'
        required: false
      responses:
        '200':
          description: Success - one page of opted-out legion_ids
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OptOutsResponse'
              example:
                legion_ids:
                  - 0b6e2f4a-3c1d-5e7f-8a9b-1c2d3e4f5a6b
                  - 5d8a1c3e-7f2b-5a4c-9e6d-2b3c4d5e6f7a
                next_cursor: pTq9vX2LwYc8nK3mR0sB7hJ4dF6gA1eZ_u5oN-iQ2yW9tE
        '400':
          description: Bad request - a cursor that can't be read or came from elsewhere
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Service temporarily unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    OptOutsRequest:
      description: >-
        Request model for the opt-out list: a page, paged as Search pages
        (limit, then next_cursor as cursor).
      example:
        limit: 10000
      properties:
        limit:
          default: 1000
          description: 'legion_ids per page (default: 1,000, max: 10,000).'
          maximum: 10000
          minimum: 1
          title: Limit
          type: integer
        cursor:
          anyOf:
            - maxLength: 65536
              type: string
            - type: 'null'
          default: null
          description: >-
            Continue from the previous page's next_cursor: the next page of the
            list. Omit for the first page.
          title: Cursor
      type: object
      title: OptOutsRequest
    OptOutsResponse:
      properties:
        legion_ids:
          items:
            type: string
          type: array
          title: Legion Ids
          description: >-
            legion_ids of people who opted out or asked to be deleted, and the
            legion_ids they had before records were merged or split, in
            ascending order. Delete these people from data you received from us.
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
          description: Pass as `cursor` to read the next page; null on the last page.
      type: object
      required:
        - legion_ids
      title: OptOutsResponse
      description: One page of opted-out person records.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: Error type/code
        message:
          type: string
          title: Message
          description: Human-readable error message
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - items: {}
              type: array
            - type: 'null'
          title: Details
          description: Additional error details (for validation errors)
      type: object
      required:
        - error
        - message
      title: ErrorResponse
      description: Error response model for customer-facing API.
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: API-Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.