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

# Enrich a company

> Enqueues an async enrichment for a company, identified by domain or
LinkedIn company URL. Provide exactly one of `domain` or
`linkedinUrl`.

Responds `200` if the task settled immediately (a cache hit — the
common case once a company has been seen before), or `202` if it was
queued. Both responses share the same shape; the response body never
carries the enrichment result itself, only the task. Poll `GET
/v1/tasks/{id}` or supply `loop_id` to get the result delivered to a
webhook.




## OpenAPI

````yaml /openapi.json post /v1/companies/enrich
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/companies/enrich:
    post:
      tags:
        - Companies
      summary: Enrich a company
      description: |
        Enqueues an async enrichment for a company, identified by domain or
        LinkedIn company URL. Provide exactly one of `domain` or
        `linkedinUrl`.

        Responds `200` if the task settled immediately (a cache hit — the
        common case once a company has been seen before), or `202` if it was
        queued. Both responses share the same shape; the response body never
        carries the enrichment result itself, only the task. Poll `GET
        /v1/tasks/{id}` or supply `loop_id` to get the result delivered to a
        webhook.
      operationId: enrichCompany
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: |
            Reusing the same key returns the original task rather than
            creating (and charging for) a new one — safe to retry a request
            whose response you never received.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                domain:
                  type: string
                  description: A company's domain, e.g. `"stripe.com"`.
                  example: stripe.com
                linkedinUrl:
                  type: string
                  description: A LinkedIn company page URL, as an alternative to `domain`.
                  example: https://www.linkedin.com/company/stripe
                loop_id:
                  type: string
                  format: uuid
                  description: |
                    Deliver the result to this Loop's webhook once it's
                    ready, in addition to polling this task directly.
              additionalProperties: false
      responses:
        '200':
          description: The task settled immediately (cache hit or idempotent replay).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskEnqueueResponse'
        '202':
          description: The task was queued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskEnqueueResponse'
        '400':
          description: >-
            Malformed request body (e.g. neither `domain` nor `linkedinUrl`, or
            both, provided).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    TaskEnqueueResponse:
      type: object
      description: |
        Never carries `data` — only `error`, and only if the task already
        failed synchronously (e.g. an immediate negative-cache hit). Fetch
        the result from `GET /v1/tasks/{id}` or a Loop webhook.
      properties:
        task:
          $ref: '#/components/schemas/Task'
        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
    TaskError:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/TaskErrorCode'
        message:
          type: string
      required:
        - code
        - message
    TaskStatus:
      type: string
      enum:
        - queued
        - running
        - succeeded
        - failed
        - canceled
    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
    PaymentRequired:
      description: Insufficient or expired credits.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
              code:
                type: string
                enum:
                  - credits_expired
                  - insufficient_credits
              creditsRemaining:
                type: number
            required:
              - error
    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
    InternalError:
      description: Something went wrong on our end.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
              requestId:
                type: string
            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**.

````