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

# Cancel Bulk Lookalike Job

> Cancel a running or pending bulk lookalike job. Submit a job first via **`POST /api/v1/account/search-lookalikes-bulk`** ("Search Lookalikes Bulk", under Company Search), which returns a `job_id`.

<Info>**No API key yet?** [Sign up via Agent Auth](/agent-auth/agent-auth/agent-sign-up) to get your `X-API-Key` - the only required header for this endpoint.</Info>

The job moves to a transient `cancelling` state and stops at its next checkpoint. Whatever pages were already produced are kept and remain readable via the poll endpoint, and you are charged **only for the companies actually delivered** before the cancel - nothing for the abandoned remainder. The job then settles to a terminal `cancelled` status.

Returns **409** if the job has already finished (`completed` / `failed` / `cancelled`), and **404** if no job with that id exists for your API key. Poll **`GET /api/v1/account/search-lookalikes-bulk/{job_id}`** for the final `cancelled` state and the partial results.

## When to cancel
Cancel when finishing the job is no longer worth it - e.g. you requested a large `limit` but already have enough companies from the pages delivered so far, the query turned out too broad, or you simply want to stop spend. Because credits are billed **only for companies actually delivered** before the cancel (never the abandoned remainder), cancelling early is how you cap credit usage on an over-scoped job.



## OpenAPI

````yaml agent-primitives/openapi.json POST /api/v1/account/search-lookalikes-bulk/{job_id}/cancel
openapi: 3.1.0
info:
  title: OpenFunnel Agent Primitives
  version: 1.0.0
servers:
  - url: https://api.openfunnel.dev
security: []
paths:
  /api/v1/account/search-lookalikes-bulk/{job_id}/cancel:
    post:
      tags:
        - Cancel Bulk Lookalike Job
      summary: Cancel Bulk Lookalike Job
      description: >-
        Cancel a running or pending bulk lookalike job. Submit a job first via
        **`POST /api/v1/account/search-lookalikes-bulk`** ("Search Lookalikes
        Bulk", under Company Search), which returns a `job_id`.


        <Info>**No API key yet?** [Sign up via Agent
        Auth](/agent-auth/agent-auth/agent-sign-up) to get your `X-API-Key` -
        the only required header for this endpoint.</Info>


        The job moves to a transient `cancelling` state and stops at its next
        checkpoint. Whatever pages were already produced are kept and remain
        readable via the poll endpoint, and you are charged **only for the
        companies actually delivered** before the cancel - nothing for the
        abandoned remainder. The job then settles to a terminal `cancelled`
        status.


        Returns **409** if the job has already finished (`completed` / `failed`
        / `cancelled`), and **404** if no job with that id exists for your API
        key. Poll **`GET /api/v1/account/search-lookalikes-bulk/{job_id}`** for
        the final `cancelled` state and the partial results.


        ## When to cancel

        Cancel when finishing the job is no longer worth it - e.g. you requested
        a large `limit` but already have enough companies from the pages
        delivered so far, the query turned out too broad, or you simply want to
        stop spend. Because credits are billed **only for companies actually
        delivered** before the cancel (never the abandoned remainder),
        cancelling early is how you cap credit usage on an over-scoped job.
      operationId: >-
        search_lookalikes_bulk_cancel_api_v1_account_search_lookalikes_bulk__job_id__cancel_post
      parameters:
        - name: job_id
          in: path
          required: true
          schema:
            type: string
            title: Job Id
          description: The `job_id` returned by the bulk submit endpoint.
        - name: X-API-Key
          in: header
          required: true
          schema:
            type: string
            title: X-Api-Key
      responses:
        '200':
          description: Cancellation accepted; the job is now `cancelling`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkLookalikeCancelResponse'
              example:
                job_id: d8a1bddb-44f1-4c7f-87a7-f37496354ff6
                status: cancelling
                message: >-
                  Cancellation requested. Poll GET
                  /api/v1/account/search-lookalikes-bulk/d8a1bddb-44f1-4c7f-87a7-f37496354ff6
                  for the final status and the companies processed before
                  cancellation.
        '404':
          description: Job not found for this API key.
        '409':
          description: >-
            Job already finished (completed / failed / cancelled); cannot
            cancel.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: bash
          label: Cancel job
          source: >-
            curl -sS -X POST
            "https://api.openfunnel.dev/api/v1/account/search-lookalikes-bulk/JOB_ID/cancel"
            \
              -H "X-API-Key: YOUR_API_KEY"
components:
  schemas:
    BulkLookalikeCancelResponse:
      type: object
      title: BulkLookalikeCancelResponse
      description: >-
        Acknowledgement returned by the bulk-lookalike cancel endpoint.
        Cancellation is asynchronous - poll the GET endpoint for the final
        `cancelled` state and the companies processed before the cancel.
      required:
        - job_id
        - message
      properties:
        job_id:
          type: string
          title: Job Id
        status:
          type: string
          default: cancelling
          title: Status
          description: Always `cancelling` - the cancel request was accepted.
        message:
          type: string
          title: Message
          description: 'Next step: where to fetch the companies processed before the cancel.'
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ValidationError:
      type: object
      required:
        - loc
        - msg
        - type
      properties:
        loc:
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          type: string
        type:
          type: string

````