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

# Check on a task

> Returns the task, plus `data` once it has succeeded or `error` once
it has failed. A task belonging to another organization returns
`404`, indistinguishable from one that doesn't exist.




## OpenAPI

````yaml /openapi.json get /v1/tasks/{id}
openapi: 3.1.0
info:
  title: EnrichLoop API
  version: 0.1.0
  description: |
    Send us a company. We enrich it and send the result back — either to you
    directly, or to a webhook you register (a **Loop**). Built for teams
    enriching data as part of a pipeline: signups, CRM records, lead lists,
    anything that needs a company's firmographic data attached to it.

    ## How it works

    1. You send us something to enrich — a domain or a LinkedIn company URL.
    2. We check whether we already know it. If we do, the task settles
       immediately.
    3. If we don't, we go find it — resolving the domain, locating the
       company's LinkedIn page, and pulling structured data from it — and
       queue the result for you.
    4. You get the result by polling the task, or by registering a Loop and
       having it delivered to your webhook automatically.

    Every enqueue endpoint (`POST /v1/companies/enrich`, `POST
    /v1/loops/{id}/run`) always responds with a task id only — never the
    company data inline, even when the task settles instantly off the cache.
    `200` vs. `202` tells you whether it already settled; either way, fetch
    the result from `GET /v1/tasks/{id}` or via your Loop's webhook.
  contact:
    name: EnrichLoop support
servers:
  - url: https://api.enrichloop.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Companies
    description: Enqueue a company enrichment.
  - name: Tasks
    description: Poll or list the async tasks behind an enrichment.
  - name: Loops
    description: Webhook delivery — register a destination and send records to it.
paths:
  /v1/tasks/{id}:
    get:
      tags:
        - Tasks
      summary: Check on a task
      description: |
        Returns the task, plus `data` once it has succeeded or `error` once
        it has failed. A task belonging to another organization returns
        `404`, indistinguishable from one that doesn't exist.
      operationId: getTask
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: |
            The task. While `status` is `queued` or `running`, a
            `Retry-After: 2` header is included as a polling hint.
          headers:
            Retry-After:
              description: >-
                Seconds to wait before polling again. Only present while the
                task is pending.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskDetailResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: No task with this id in the caller's organization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    TaskDetailResponse:
      type: object
      properties:
        task:
          $ref: '#/components/schemas/Task'
        data:
          $ref: '#/components/schemas/Company'
        error:
          $ref: '#/components/schemas/TaskError'
      required:
        - task
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
      required:
        - error
    Task:
      type: object
      description: |
        `input` and `target` are dropped in future revisions to a single
        field; today `target` is the normalized domain or LinkedIn URL the
        task resolved to.
      properties:
        id:
          type: string
          format: uuid
        object_type:
          type: string
          enum:
            - company
        operation:
          type: string
          enum:
            - enrich
        status:
          $ref: '#/components/schemas/TaskStatus'
        input:
          type: object
          additionalProperties: true
        target:
          type: string
          description: >-
            The normalized input we resolved — the domain or LinkedIn URL you
            sent.
        credits_charged:
          type: integer
        loop_id:
          type:
            - string
            - 'null'
          format: uuid
        idempotency_key:
          type:
            - string
            - 'null'
        created_at:
          type: string
          format: date-time
        queued_at:
          type:
            - string
            - 'null'
          format: date-time
        started_at:
          type:
            - string
            - 'null'
          format: date-time
        finished_at:
          type:
            - string
            - 'null'
          format: date-time
        expires_at:
          type: string
          format: date-time
          description: >-
            If the task is still running past this time, it will be marked
            `failed`.
      required:
        - id
        - object_type
        - operation
        - status
        - target
        - credits_charged
        - created_at
    Company:
      type: object
      description: Present as `data` once a task's `status` is `"succeeded"`.
      properties:
        name:
          type: string
        domain:
          type:
            - string
            - 'null'
        linkedin_url:
          type:
            - string
            - 'null'
        linkedin_id:
          type:
            - string
            - 'null'
        linkedin_followers:
          type:
            - integer
            - 'null'
        employee_count:
          type:
            - integer
            - 'null'
        employee_range:
          type:
            - string
            - 'null'
        primary_industry:
          type:
            - string
            - 'null'
        organization_type:
          type:
            - string
            - 'null'
        year_founded:
          type:
            - integer
            - 'null'
        about:
          type:
            - string
            - 'null'
        slogan:
          type:
            - string
            - 'null'
        enrichment_status:
          type: string
          enum:
            - pending
            - enriched
            - failed
        headquarters:
          $ref: '#/components/schemas/Headquarters'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        redirect:
          type: object
          description: |
            Present only when the domain you sent resolved to a different
            canonical domain (e.g. a redirect or a LinkedIn-reported
            shortlink).
          properties:
            from:
              type: string
            to:
              type: string
            confirmed:
              type: boolean
          required:
            - from
            - to
            - confirmed
      required:
        - name
        - enrichment_status
    TaskError:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/TaskErrorCode'
        message:
          type: string
      required:
        - code
        - message
    TaskStatus:
      type: string
      enum:
        - queued
        - running
        - succeeded
        - failed
        - canceled
    Headquarters:
      type:
        - object
        - 'null'
      additionalProperties: true
      properties:
        city:
          type: string
        country:
          type: string
    TaskErrorCode:
      type: string
      description: Stable across the queued/polled and webhook paths — safe to branch on.
      enum:
        - not_found
        - provider_unavailable
        - timed_out
        - invalid_input
        - internal_error
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        text/plain:
          schema:
            type: string
            example: Unauthorized
    TooManyRequests:
      description: |
        Rate limited. `Retry-After` gives the number of seconds to wait. A
        `code: "queue_full"` body means the organization's queued-task
        backlog is full rather than the per-IP request rate being exceeded.
      headers:
        Retry-After:
          schema:
            type: integer
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
              code:
                type: string
                enum:
                  - queue_full
              queuedTasks:
                type: integer
            required:
              - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        Pass your API key as a bearer token: `Authorization: Bearer
        YOUR_API_KEY`. Generate and manage keys from your dashboard under
        **Settings → API Keys**.

````