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

# Search candidates

> Search candidates in the Leonar database or via LinkedIn.



## OpenAPI

````yaml /openapi.yaml post /sourcing/search
openapi: 3.0.3
info:
  title: Leonar API
  description: >
    REST API for accessing and managing workspace data in Leonar CRM.


    ## Authentication


    All API requests require a Bearer token in the Authorization header:


    ```

    Authorization: Bearer leo_xxxxx

    ```


    API keys can be created and managed in Settings > API.


    ## Rate limiting


    - **2000 requests per hour by default**, configurable per workspace and
    shared by all API keys owned by the same user

    - Rate limit headers are included in all responses


    ## Pagination


    List endpoints support pagination via `limit` and `offset` query parameters.
  version: 1.0.0
  contact:
    name: Leonar Support
    url: https://leonar.ai
    email: support@leonar.ai
servers:
  - url: https://app.leonar.app/api/v1
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Contacts
    description: Manage contacts in your workspace
  - name: Companies
    description: Manage companies and their relationships
  - name: Deals
    description: Track and manage sales deals
  - name: Deal Pipelines
    description: View deal pipeline configurations
  - name: Projects
    description: Organize recruiting projects
  - name: Pipeline Entries
    description: Manage candidates in project pipelines
  - name: Tasks
    description: Track to-dos and follow-ups
  - name: Tags
    description: Organize resources with tags
  - name: Notes
    description: Manage notes on contacts, companies, deals, and projects
  - name: Sequences
    description: Automate outreach campaigns
  - name: Conversations
    description: View conversations across channels
  - name: Messages
    description: Send messages via email, LinkedIn, or WhatsApp
  - name: Enrichment
    description: Find emails and phone numbers for contacts
  - name: Sourcing
    description: Search and import candidates
  - name: Connected Accounts
    description: View linked LinkedIn accounts
paths:
  /sourcing/search:
    post:
      tags:
        - Sourcing
      summary: Search candidates
      description: Search candidates in the Leonar database or via LinkedIn.
      operationId: search
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - project_id
                - source_type
                - filters
                - page
                - page_size
              properties:
                project_id:
                  type: string
                  format: uuid
                source_type:
                  type: string
                  enum:
                    - leonar_source
                    - contacts
                    - linkedin
                filters:
                  type: object
                  description: >
                    Search filters vary by `source_type`:

                    - For `leonar_source` and `contacts`: use `locations` with
                    plain-text names.

                    - For `linkedin`: use `linkedin_filters.location_ids` with
                    IDs from `GET /sourcing/locations`.
                  properties:
                    job_titles:
                      type: object
                      properties:
                        include:
                          type: array
                          items:
                            type: string
                        include_current_only:
                          type: boolean
                    companies:
                      type: object
                      properties:
                        include:
                          type: array
                          items:
                            type: string
                        exclude:
                          type: array
                          items:
                            type: string
                    locations:
                      type: object
                      description: >-
                        For `leonar_source` and `contacts` only. Use plain-text
                        location names.
                      properties:
                        cities:
                          type: array
                          items:
                            type: string
                        states:
                          type: array
                          items:
                            type: string
                        countries:
                          type: array
                          items:
                            type: string
                    linkedin_filters:
                      type: object
                      description: For `linkedin` source only.
                      properties:
                        location_ids:
                          type: object
                          additionalProperties:
                            type: string
                          description: >
                            Dictionary of location IDs to titles. Get IDs from
                            `GET /sourcing/locations`.

                            Example: `{"103644278": "New York, United States"}`
                    skills:
                      type: object
                      properties:
                        include:
                          type: array
                          items:
                            type: string
                        require_all:
                          type: boolean
                    years_experience:
                      type: object
                      properties:
                        min:
                          type: integer
                        max:
                          type: integer
                page:
                  type: integer
                  minimum: 1
                page_size:
                  type: integer
                  minimum: 1
                  maximum: 100
                account_id:
                  type: string
                  format: uuid
                  description: Required for LinkedIn source
                linkedin_api_type:
                  type: string
                  enum:
                    - recruiter
                    - sales_navigator
      responses:
        '200':
          description: Search results
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      profiles:
                        type: array
                        items:
                          type: object
                      total_count:
                        type: integer
                      filtered_count:
                        type: integer
                      next_page:
                        type: integer
                        nullable: true
                      has_more:
                        type: boolean
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  responses:
    ValidationError:
      description: Invalid request data
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: validation_error
              message: Invalid input
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: invalid_api_key
              message: Invalid API key
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - invalid_api_key
                - insufficient_scope
                - rate_limit_exceeded
                - validation_error
                - not_found
                - internal_error
                - billing_required
                - plan_upgrade_required
              description: >
                Error codes:

                - `invalid_api_key` — API key is missing, malformed, or revoked

                - `insufficient_scope` — API key lacks the required scope for
                this endpoint

                - `rate_limit_exceeded` — Too many requests (2000/hour)

                - `validation_error` — Request body or parameters failed
                validation

                - `not_found` — The requested resource does not exist

                - `internal_error` — Unexpected server error

                - `billing_required` — Workspace has no active subscription

                - `plan_upgrade_required` — Current plan does not include this
                feature
            message:
              type: string
              description: Human-readable error description
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key starting with `leo_`

````