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

# Create or update a saved search

> Store a search without running it. Pass `id` to update an existing profile in place.

Requires the `write` permission.



## OpenAPI

````yaml POST /api/leads/research-profiles
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.
  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.
paths:
  /api/leads/research-profiles:
    post:
      tags:
        - Leads
      summary: Create or update a saved search
      description: >-
        Store a search without running it. Pass `id` to update an existing
        profile in place.


        Requires the `write` permission.
      operationId: saveResearchProfile
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - criteria
              properties:
                id:
                  type: string
                  format: uuid
                name:
                  type: string
                  maxLength: 120
                kind:
                  type: string
                  enum:
                    - icp
                    - similar
                criteria:
                  $ref: '#/components/schemas/LeadResearchCriteria'
      responses:
        '200':
          description: The saved profile.
          content:
            application/json:
              schema:
                type: object
                properties:
                  profile:
                    $ref: '#/components/schemas/ResearchProfile'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    LeadResearchCriteria:
      type: object
      description: >-
        The structured search. The description does most of the work; the rest
        is what the agent enforces.
      properties:
        description:
          type: string
          maxLength: 4000
          description: Free-text ideal-customer description.
        count:
          type: integer
          minimum: 1
          default: 25
          description: How many NEW leads to save. Clamped to remaining plan capacity.
        locations:
          type: array
          maxItems: 20
          items:
            type: string
        industries:
          type: array
          maxItems: 20
          items:
            type: string
        company_size:
          type: string
          maxLength: 160
          description: 'Free text on purpose: "5-50 employees", "Series A", "under $5M ARR".'
        titles:
          type: array
          maxItems: 20
          items:
            type: string
          description: Roles to reach inside each company.
        keywords:
          type: array
          maxItems: 30
          items:
            type: string
          description: Signals a company must show.
        exclusions:
          type: array
          maxItems: 30
          items:
            type: string
          description: Hard excludes — matches are dropped, not saved.
        required_fields:
          type: array
          maxItems: 6
          items:
            type: string
            enum:
              - email
              - phone
              - full_name
              - title
              - linkedin_url
              - location
          default:
            - email
          description: A lead missing one of these is not saved.
        extra_columns:
          type: array
          maxItems: 10
          items:
            type: object
            properties:
              name:
                type: string
                maxLength: 60
              description:
                type: string
                maxLength: 300
          description: Extra researched columns, written to the lead's custom fields.
        sources:
          type: array
          maxItems: 10
          items:
            type: string
          description: 'Where to look: directories, marketplaces, maps, specific sites.'
        notes:
          type: string
          maxLength: 2000
    ResearchProfile:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        kind:
          type: string
          enum:
            - icp
            - similar
        criteria:
          $ref: '#/components/schemas/LeadResearchCriteria'
        run_count:
          type: integer
        last_run_at:
          type: string
          format: date-time
          nullable: true
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable message.
        code:
          type: string
          description: >-
            A machine-readable code on gated failures: `lead_limit`,
            `outreach_locked`, `validation_credits_exhausted`.
  responses:
    BadRequest:
      description: The request body or parameters failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: >-
        Missing, invalid or expired credential — or a key that lacks the
        permission this route requires.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        A ManyPI API key (`mpi_...`) from Settings → API keys, or an OAuth 2.1
        access token obtained through the MCP consent flow.

````