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

# Build ICP lead cards

> “Find leads”: builds the search filters and a free audience count for every selected profile of an answered analysis (select or deselect a profile with `PATCH …/profiles/{profileId}` first). Filters and counts are made in the background: read them with `GET /api/v1/icp/analyses/{analysisId}`. The same contract as the web app’s ICP Builder (an API key instead of a session).

#### Billing

Free — this endpoint does not consume points.



## OpenAPI

````yaml /openapi.json post /api/v1/icp/analyses/{analysisId}/cards
openapi: 3.1.0
info:
  title: Loice API
  version: v1
  description: >-
    The Loice API finds and verifies professional contact data. Every capability
    is exposed here, key-authenticated and rate-limited; the web app is a client
    of the same platform.


    **Authentication** — pass your workspace API key on every request (except
    the API description) as `Authorization: Bearer loice_sk_…`. Keys are created
    under Settings → API Keys.


    **Billing** — operations are billed in points against your workspace
    balance. Each operation below states when the charge applies. The current
    cost of every operation is shown in the app under [Settings →
    Billing](https://app.loice.ai/settings/account?tab=billing) and in the live
    API description, `GET /api/v1/openapi.json`. Calls that fail because of a
    system or provider error (timeouts, upstream failures, our defects) are not
    billed, and rate-limited calls are rejected before any billable work. Check
    headroom with `GET /api/v1/points`. Where an operation documents an
    `Idempotency-Key` header, send one to retry safely: a repeated request
    returns the original outcome and is not charged again.


    **Errors** — every non-200 response has the shape `{ "error": { "message":
    "…" } }`. Operations whose error responses document an `error.code` also
    return that machine-readable code beside the message; branch on the code,
    not the text.
servers:
  - url: https://app.loice.ai
security: []
paths:
  /api/v1/icp/analyses/{analysisId}/cards:
    post:
      summary: Build ICP lead cards
      description: >-
        “Find leads”: builds the search filters and a free audience count for
        every selected profile of an answered analysis (select or deselect a
        profile with `PATCH …/profiles/{profileId}` first). Filters and counts
        are made in the background: read them with `GET
        /api/v1/icp/analyses/{analysisId}`. The same contract as the web app’s
        ICP Builder (an API key instead of a session).


        #### Billing


        Free — this endpoint does not consume points.
      parameters:
        - schema:
            type: string
            description: Analysis id from `POST /api/v1/icp/analyses`.
          required: true
          description: Analysis id from `POST /api/v1/icp/analyses`.
          name: analysisId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type:
                - object
                - 'null'
              properties:
                edited:
                  type: string
                  enum:
                    - replace
                    - keep
              additionalProperties: {}
            example: {}
      responses:
        '200':
          description: The analysis, its cards pending.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      analysis:
                        type: object
                        properties:
                          id:
                            type: string
                          status:
                            type: string
                            enum:
                              - queued
                              - processing
                              - cancelling
                              - completed
                              - failed
                              - cancelled
                          outcome:
                            type:
                              - string
                              - 'null'
                            enum:
                              - answered
                              - not_found
                              - unavailable
                              - cancelled
                              - null
                            description: null while the analysis runs.
                          reason:
                            type:
                              - string
                              - 'null'
                          inputUrl:
                            type: string
                          siteLabel:
                            type: string
                          stages:
                            type: object
                            properties:
                              read:
                                type: string
                              products:
                                type: string
                              profiles:
                                type: string
                            required:
                              - read
                              - products
                              - profiles
                          pagesRead:
                            type: integer
                          profilesDrafted:
                            type: integer
                          site:
                            type:
                              - object
                              - 'null'
                            properties:
                              name:
                                type: string
                              description:
                                type: string
                              products:
                                type: array
                                items:
                                  type: object
                                  properties: {}
                                  additionalProperties: {}
                              useCases:
                                type: array
                                items:
                                  type: object
                                  properties: {}
                                  additionalProperties: {}
                            required:
                              - name
                              - description
                              - products
                              - useCases
                            additionalProperties: {}
                          profiles:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                position:
                                  type: integer
                                origin:
                                  type: string
                                  enum:
                                    - drafted
                                    - custom
                                name:
                                  type: string
                                audience:
                                  type: string
                                offer:
                                  type: string
                                problem:
                                  type: string
                                selected:
                                  type: boolean
                                filtersStatus:
                                  type:
                                    - string
                                    - 'null'
                                filtersStale:
                                  type: boolean
                                card:
                                  type:
                                    - object
                                    - 'null'
                                  properties:
                                    filters:
                                      type: object
                                      additionalProperties:
                                        type: array
                                        items:
                                          type: string
                                      description: >-
                                        Lead-search filters keyed by criterion
                                        (`jobTitle`, `location`, `industry`,
                                        `headcount`, `seniority`, `department`,
                                        `keywords`, …), each a list of values.
                                    selected:
                                      type: boolean
                                    count:
                                      type: object
                                      properties:
                                        status:
                                          type: string
                                          enum:
                                            - pending
                                            - answered
                                            - unavailable
                                            - invalid
                                          description: >-
                                            `pending` while the free audience count
                                            runs; `unavailable` when it did not
                                            answer (re-count with `POST
                                            …/profiles/{profileId}/count`).
                                        total:
                                          type:
                                            - integer
                                            - 'null'
                                        reason:
                                          type:
                                            - string
                                            - 'null'
                                      required:
                                        - status
                                        - total
                                        - reason
                                    generation:
                                      type: object
                                      properties:
                                        status:
                                          type: string
                                          description: The card’s filter generation.
                                        reason:
                                          type:
                                            - string
                                            - 'null'
                                      required:
                                        - status
                                        - reason
                                    edited:
                                      type: boolean
                                      description: >-
                                        The filters were edited since they were
                                        generated.
                                    relaxation:
                                      type:
                                        - object
                                        - 'null'
                                      properties: {}
                                      additionalProperties: {}
                                  required:
                                    - filters
                                    - selected
                                    - count
                                    - generation
                                    - edited
                                    - relaxation
                                  additionalProperties: {}
                                  description: >-
                                    The Find-leads card: null until `POST
                                    …/cards` built it.
                              required:
                                - id
                                - position
                                - origin
                                - name
                                - audience
                                - offer
                                - problem
                                - selected
                                - filtersStatus
                                - filtersStale
                                - card
                              additionalProperties: {}
                          generationId:
                            type:
                              - string
                              - 'null'
                          createdAt:
                            type: string
                          updatedAt:
                            type: string
                        required:
                          - id
                          - status
                          - outcome
                          - reason
                          - inputUrl
                          - siteLabel
                          - stages
                          - pagesRead
                          - profilesDrafted
                          - site
                          - profiles
                          - generationId
                          - createdAt
                          - updatedAt
                        additionalProperties: {}
                    required:
                      - analysis
                required:
                  - data
              example:
                data:
                  analysis:
                    id: cmh0a1
                    status: completed
                    outcome: answered
                    reason: null
                    inputUrl: loice.ai
                    siteLabel: loice.ai
                    stages:
                      read: done
                      products: done
                      profiles: done
                    pagesRead: 4
                    profilesDrafted: 1
                    fromCache: false
                    site:
                      name: Loice
                      description: B2B contact data.
                      products:
                        - name: Email Finder
                          description: Verified work emails.
                      useCases:
                        - problem: Bounced outreach
                          audience: Sales teams
                    profiles:
                      - id: cmh0p1
                        position: 0
                        origin: drafted
                        name: Outbound sales teams
                        audience: SDR managers at B2B SaaS companies
                        offer: Verified work emails
                        problem: Bounced outreach
                        filters: {}
                        selected: true
                        filtersStatus: answered
                        filtersStale: false
                        card:
                          filters:
                            jobTitle:
                              - Head of Sales
                            headcount:
                              - 51-200
                          selected: true
                          count:
                            status: answered
                            total: 1200
                            reason: null
                          generation:
                            status: answered
                            reason: null
                          edited: false
                          relaxation: null
                    generationId: null
                    createdAt: '2026-11-10T09:00:00.000Z'
                    updatedAt: '2026-11-10T09:00:00.000Z'
        '400':
          description: '`validation_error`: `edited` is not `replace` or `keep`.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - validation_error
                          - unauthenticated
                          - not_found
                          - forbidden
                          - method_not_allowed
                          - idempotency_conflict
                          - idempotency_in_progress
                          - rate_limited
                          - internal_error
                          - run_already_active
                          - run_already_continued
                          - search_unavailable
                          - invalid_continuation
                          - invalid_input
                          - insufficient_credits
                          - incomplete
                          - list_name_taken
                          - confirmation_required
                          - confirmation_mismatch
                          - selection_too_large
                        description: >-
                          Machine-readable error code. Branch on this, not on
                          `message`.
                      message:
                        type: string
                        description: Human-readable explanation.
                      retryAfterSeconds:
                        type: integer
                        description: >-
                          Present on a 429 only: seconds until the workspace may
                          call again (same value as the `Retry-After` header).
                    required:
                      - code
                      - message
                required:
                  - error
        '401':
          description: >-
            API key missing (`Missing API key. Pass it as: Authorization: Bearer
            <key>`), invalid (`Invalid API key`), or expired (`This API key has
            expired`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                    required:
                      - message
                required:
                  - error
        '404':
          description: >-
            `not_found`: no such analysis (or profile) in this workspace — an
            unknown id or one of another workspace; identical for both.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - validation_error
                          - unauthenticated
                          - not_found
                          - forbidden
                          - method_not_allowed
                          - idempotency_conflict
                          - idempotency_in_progress
                          - rate_limited
                          - internal_error
                          - run_already_active
                          - run_already_continued
                          - search_unavailable
                          - invalid_continuation
                          - invalid_input
                          - insufficient_credits
                          - incomplete
                          - list_name_taken
                          - confirmation_required
                          - confirmation_mismatch
                          - selection_too_large
                        description: >-
                          Machine-readable error code. Branch on this, not on
                          `message`.
                      message:
                        type: string
                        description: Human-readable explanation.
                      retryAfterSeconds:
                        type: integer
                        description: >-
                          Present on a 429 only: seconds until the workspace may
                          call again (same value as the `Retry-After` header).
                    required:
                      - code
                      - message
                required:
                  - error
        '405':
          description: Method not allowed — see the `Allow` response header.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                    required:
                      - message
                required:
                  - error
        '409':
          description: >-
            `analysis_not_ready`: the analysis has not answered yet.
            `filters_edited`: a profile whose text changed has hand-edited card
            filters (`error.meta.profileIds`); send `edited: "replace"` or
            `"keep"`. Nothing changed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - validation_error
                          - unauthenticated
                          - not_found
                          - forbidden
                          - method_not_allowed
                          - idempotency_conflict
                          - idempotency_in_progress
                          - rate_limited
                          - internal_error
                          - run_already_active
                          - run_already_continued
                          - search_unavailable
                          - invalid_continuation
                          - invalid_input
                          - insufficient_credits
                          - incomplete
                          - list_name_taken
                          - confirmation_required
                          - confirmation_mismatch
                          - selection_too_large
                        description: >-
                          Machine-readable error code. Branch on this, not on
                          `message`.
                      message:
                        type: string
                        description: Human-readable explanation.
                      retryAfterSeconds:
                        type: integer
                        description: >-
                          Present on a 429 only: seconds until the workspace may
                          call again (same value as the `Retry-After` header).
                    required:
                      - code
                      - message
                required:
                  - error
        '429':
          description: >-
            Rate limit exceeded for this workspace. Retry after the number of
            seconds in the `Retry-After` header (60). Rate-limited calls are
            never billed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                    required:
                      - message
                required:
                  - error
        '500':
          description: '`internal_error`: failed on our side. Never billed.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - validation_error
                          - unauthenticated
                          - not_found
                          - forbidden
                          - method_not_allowed
                          - idempotency_conflict
                          - idempotency_in_progress
                          - rate_limited
                          - internal_error
                          - run_already_active
                          - run_already_continued
                          - search_unavailable
                          - invalid_continuation
                          - invalid_input
                          - insufficient_credits
                          - incomplete
                          - list_name_taken
                          - confirmation_required
                          - confirmation_mismatch
                          - selection_too_large
                        description: >-
                          Machine-readable error code. Branch on this, not on
                          `message`.
                      message:
                        type: string
                        description: Human-readable explanation.
                      retryAfterSeconds:
                        type: integer
                        description: >-
                          Present on a 429 only: seconds until the workspace may
                          call again (same value as the `Retry-After` header).
                    required:
                      - code
                      - message
                required:
                  - error
      security:
        - workspaceApiKey: []
components:
  securitySchemes:
    workspaceApiKey:
      type: http
      scheme: bearer
      description: >-
        Workspace API key (`loice_sk_` + 48 hex characters), created under
        Settings → API Keys. Sent as `Authorization: Bearer loice_sk_…`.
        Invalid, missing, or expired keys are rejected with 401 before any
        billable work happens.

````

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