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

# Export chosen leads

> The same export as `GET /api/leads/export`, with the settings in a JSON body. Send `ids` to export exactly those leads (up to 10,000); otherwise the filters apply.

An API key needs **Leads & companies: Read & write** (`leads:write`), or the legacy `write` permission. A read-only key cannot use this form; use the `GET` form instead.



## OpenAPI

````yaml POST /api/leads/export
openapi: 3.1.0
info:
  title: ManyPI API
  description: >-
    The REST API behind ManyPI — AI lead generation, email validation,
    cold-email outreach, agent runs and web scraping. Every endpoint is
    authenticated with a ManyPI API key (`mpi_...`) or an OAuth 2.1 access
    token, and honours the permissions granted to that credential.


    API keys carry permissions per area of the API (Leads & companies,
    Campaigns, Inboxes & replies, Agents & skills, Scrapers & data, Account &
    usage), each set to Read or Read & write, plus separate permissions for
    actions that spend credits or reach the outside world: Run agents, Run
    scrapers, Verify email addresses, Send outreach and Invoke endpoints. Each
    operation below names what it needs. Keys with the older `read` and `write`
    permissions keep working everywhere.
  version: 2.0.0
  contact:
    name: ManyPI Support
    email: support@manypi.com
    url: https://manypi.com
servers:
  - url: https://app.manypi.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Leads
    description: Find, store, enrich and manage leads.
  - name: Email validation
    description: Verify that lead addresses can receive mail.
  - name: Outreach
    description: Inboxes, sequences, campaigns, sending and replies.
  - name: Agent
    description: Agent runs, replies and skills.
  - name: Scraping
    description: Scrapers, runs and extracted data.
  - name: Endpoints
    description: Publish scrapers as typed REST endpoints.
  - name: Account
    description: Key validation and account information.
  - name: Imports
    description: >-
      Bring campaigns, leads and the do-not-contact list over from another
      outreach tool.
paths:
  /api/leads/export:
    post:
      tags:
        - Leads
      summary: Export chosen leads
      description: >-
        The same export as `GET /api/leads/export`, with the settings in a JSON
        body. Send `ids` to export exactly those leads (up to 10,000); otherwise
        the filters apply.


        An API key needs **Leads & companies: Read & write** (`leads:write`), or
        the legacy `write` permission. A read-only key cannot use this form; use
        the `GET` form instead.
      operationId: exportLeadsByBody
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  maxItems: 10000
                  items:
                    type: string
                    format: uuid
                  description: Export exactly these leads.
                status:
                  type: string
                  description: A lifecycle status.
                q:
                  type: string
                campaign:
                  type: string
                  format: uuid
                  description: >-
                    The run id of a lead search: the `run_id` that `POST
                    /api/leads/research` returns, or the id of any agent run
                    that saved leads. Returns only the leads that search saved.
                    A malformed id is ignored, so the request then returns every
                    lead.
                brand:
                  type: string
                  description: >-
                    Narrow to one brand by its id. Leads with no brand are
                    always included.
                subscribed:
                  type: string
                  enum:
                    - subscribed
                    - unsubscribed
                  description: Opt-out state, separate from `status`.
                archived:
                  type: string
                  enum:
                    - hide
                    - show
                    - only
                  default: hide
                  description: >-
                    `hide` leaves archived leads out, `show` includes them,
                    `only` returns nothing else.
                owner:
                  type: string
                  description: '`unassigned`, or a workspace member''s user id.'
                list:
                  type: string
                  format: uuid
                  description: Only the leads in this lead list.
                import:
                  type: string
                  format: uuid
                  description: >-
                    Only the leads one import created (`import_id` from `POST
                    /api/leads/import`).
                missing:
                  type: string
                  description: >-
                    Comma-separated keys, at most 20. Only leads where at least
                    one of these core or custom fields is empty.
                one_per_company:
                  type: string
                  enum:
                    - 'true'
                    - '1'
                  description: >-
                    Keep only the best-ranked contact at each company. Leads
                    with no company are always kept.
                format:
                  type: string
                  enum:
                    - csv
                    - tsv
                    - json
                    - txt
                  default: csv
                columns:
                  type: string
                  description: >-
                    Comma-separated columns to include, from: company,
                    full_name, title, email, phone, phone_e164, phone_type,
                    phone_status, domain, category, subcategory, linkedin_url,
                    location, source_url, score, status, email_provider,
                    email_status, email_is_role, email_validated_at,
                    unsubscribed_at, created_at. Leave it out for all of them.
            example:
              ids:
                - d4e7f1a2-8b30-4c95-a1d6-5f2e9c8b7a04
              format: csv
      responses:
        '200':
          description: CSV file.
          content:
            text/csv:
              schema:
                type: string
            text/tab-separated-values:
              schema:
                type: string
            application/json:
              schema:
                type: array
                items:
                  type: object
            text/plain:
              schema:
                type: string
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          description: The workspace is locked for billing.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  responses:
    Unauthorized:
      description: >-
        Missing, invalid or expired credential, or an API key without the
        permission this route needs. Both look the same, so check the key's
        permissions under API Access when a key that worked elsewhere is
        refused. A few routes check the key themselves and answer `403` instead.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        error:
          description: >-
            Human-readable message. A few validation failures (creating or
            updating an endpoint, bulk lead updates and deletes) send a list of
            the individual problems here instead of one string.
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                properties:
                  path:
                    type: array
                    items:
                      type:
                        - string
                        - integer
                  message:
                    type: string
        code:
          type: string
          description: >-
            A machine-readable code on gated failures: `lead_limit`,
            `outreach_locked`, `validation_credits_exhausted`.
        details:
          description: >-
            Extra detail on some failures, such as the list of parameters that
            failed an endpoint's `param_schema`.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        A ManyPI API key (`mpi_...`) from the profile menu → API Access in the
        dashboard, or an OAuth 2.1 access token obtained through the MCP consent
        flow.

````

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