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

# Stream Companies

> Every matching company in one request, as NDJSON

> [!NOTE]
>
> **Availability:** Enterprise plan, on `https://app.gethuntd.com`. Agency keys receive
> `403 ENDPOINT_NOT_ON_PLAN`. Uses no credits, and counts as one request against your rate limit.

Returns every matching company in one response, as NDJSON (newline-delimited JSON: one JSON object
per line). Use it for backfills, full exports and scheduled syncs. To show one page of results with
a total count, use [List Companies](https://docs.gethuntd.com/api-reference/enterprise-api/list-companies.md) instead.

```bash cURL theme={null}
curl -N -X GET "https://app.gethuntd.com/api/v1/public/companies/stream?discovered_days=30" \
  -H "X-API-Key: hntd_abc12345_yoursecretkey"
```

```javascript JavaScript theme={null}
import readline from 'node:readline';
import { Readable } from 'node:stream';

const response = await fetch(
  'https://app.gethuntd.com/api/v1/public/companies/stream?discovered_days=30',
  { headers: { 'X-API-Key': process.env.HUNTD_API_KEY } }
);

const lines = readline.createInterface({ input: Readable.fromWeb(response.body) });
for await (const line of lines) {
  if (!line.trim()) continue;
  const company = JSON.parse(line);
  if (company.error) throw new Error(company.error.code); // truncated stream
  handle(company);
}
```

```python Python theme={null}
import json
import os
import requests

with requests.get(
    'https://app.gethuntd.com/api/v1/public/companies/stream',
    params={'discovered_days': 30},
    headers={'X-API-Key': os.environ['HUNTD_API_KEY']},
    stream=True,  # required, or requests buffers the whole body
) as response:
    for line in response.iter_lines():
        if not line:
            continue
        company = json.loads(line)
        if 'error' in company:
            raise RuntimeError(company['error']['code'])  # truncated stream
        handle(company)
```

```jsonl 200 (NDJSON) theme={null}
{"domain":"acme.com","name":"Acme","size":2100,"industry":"banking,financial services","country":"United States","people":12,"sources":["devin","factory"],"discoveredAt":"2026-07-31T18:31:58.294Z"}
{"domain":"globex.com","name":"Globex","size":380,"industry":"software","country":"Germany","people":3,"sources":[],"discoveredAt":"2026-07-30T09:12:40.118Z"}
```

```jsonl 200 (truncated) theme={null}
{"domain":"acme.com","name":"Acme","size":2100,"industry":"banking,financial services","country":"United States","people":12,"sources":["devin","factory"],"discoveredAt":"2026-07-31T18:31:58.294Z"}
{"success":false,"error":{"code":"STREAM_FAILED","message":"Stream failed before completion."}}
```

```json 401 theme={null}
{
  "success": false,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "API key is missing, invalid, or has been revoked."
  }
}
```

```json 403 theme={null}
{
  "success": false,
  "error": {
    "code": "SOURCE_NOT_ALLOWED",
    "message": "Your organization does not have access to source `gong`."
  }
}
```

## Overview

Each line has the same shape as a `data[]` entry from
[List Companies](https://docs.gethuntd.com/api-reference/enterprise-api/list-companies.md), with every field. The example
above is trimmed to a few fields. The format follows the [NDJSON spec](https://github.com/ndjson/ndjson-spec).

The same [filters](https://docs.gethuntd.com/public-api/conventions.md#filtering) and
[date filters](https://docs.gethuntd.com/public-api/conventions.md#date-filtering) apply. For a nightly sync, add
`discovered_days` or a `discovered_from`/`discovered_to` window so you only pull what changed.
Paging parameters (`page`, `limit`, `skip_count`) are ignored. See
[Streaming](https://docs.gethuntd.com/public-api/streaming.md) for when to stream rather than page.

## Reading the Stream

> [!WARNING]
>
> Use a **streaming line reader**, such as `curl -N`, Node `readline` or Python `iter_lines()`.
> Don't use `fetch().json()`, `requests.get().json()` or `Invoke-RestMethod`. They load the entire
> body into memory first, which defeats the point and can run out of memory on large exports.

The stream can't be resumed. If the connection drops, start again. For very large exports, stream
one `discovered_from`/`discovered_to` window at a time.

## Mid-stream Errors

Once rows are flowing, the HTTP status has already been sent, so a failure can't change it.
Instead, the **last line is an error object** and the connection closes:

```json theme={null}
{"success":false,"error":{"code":"STREAM_FAILED","message":"Stream failed before completion."}}
```

Treat a line with an `error` key as a **truncated result, not data**. Discard what you collected,
or mark it as partial, then retry.

## Errors

These come back as a normal HTTP error, before any rows are sent:

| HTTP | Error Code | Description |
| - | - | - |
| 400 | `INVALID_PARAMETER` | A query parameter is malformed or out of range |
| 401 | `INVALID_API_KEY` | API key is missing, invalid, or has been revoked |
| 403 | `ENDPOINT_NOT_ON_PLAN` | Your plan doesn't include this endpoint (Agency keys) |
| 403 | `SUBSCRIPTION_INACTIVE` | Your workspace has no active subscription. Contact your account manager. |
| 403 | `SOURCE_NOT_ALLOWED` | Your organization doesn't have access to the requested `source` |
| 423 | `SOURCE_UNAVAILABLE` | The requested `source` is paused for maintenance. Retry later. |
| 429 | `RATE_LIMIT_EXCEEDED` | Over 60 requests per minute. Wait `Retry-After` seconds. |
| 500 | `INTERNAL_ERROR` | Something broke on our side. Safe to retry. |
| 503 | `ORG_KIND_UNAVAILABLE` | Your plan briefly couldn't be confirmed. Retry. |


## OpenAPI

````yaml api-reference/public-api.json GET /api/v1/public/companies/stream
openapi: 3.0.3
info:
  title: Huntd Public API
  version: 1.0.0
  description: >-
    Read what Huntd tracks for your organization (enterprise plan), or check
    email addresses and company domains against the tools you track (Agency
    plan).
  contact:
    name: Huntd Support
    email: support@gethuntd.com
servers:
  - url: https://app.gethuntd.com
    description: Public API
security:
  - ApiKeyAuth: []
tags:
  - name: Public API
  - name: Email Check
  - name: Company Check
paths:
  /api/v1/public/companies/stream:
    get:
      tags:
        - Public API
      summary: Stream Companies
      description: >-
        Every matching company in one request, as NDJSON. Paging parameters are
        ignored.
      operationId: streamCompanies
      parameters:
        - $ref: '#/components/parameters/discovered_days'
        - $ref: '#/components/parameters/discovered_from'
        - $ref: '#/components/parameters/discovered_to'
        - $ref: '#/components/parameters/source'
        - $ref: '#/components/parameters/is_user'
      responses:
        '200':
          description: >-
            NDJSON: one company object per line, the same shape as a `data[]`
            entry from the paginated endpoint. If the stream fails after it
            started, the last line is an error object instead: treat it as a
            truncated result.
          content:
            application/x-ndjson:
              schema:
                $ref: '#/components/schemas/Company'
              example:
                domain: acme.com
                name: Acme
                size: 2100
                industry: banking,financial services
                country: United States
                people: 12
                sources:
                  - devin
                  - factory
                discoveredAt: '2026-07-31T18:31:58.294Z'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ForbiddenRows'
        '423':
          $ref: '#/components/responses/SourceUnavailable'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/PlanUnavailable'
components:
  parameters:
    discovered_days:
      name: discovered_days
      in: query
      required: false
      description: >-
        The last N UTC days, including today (`2` = today and yesterday).
        "Discovered" means when we last checked the row, not when it was
        confirmed. Can't be combined with `discovered_from` / `discovered_to`.
      schema:
        type: integer
        minimum: 1
        maximum: 366
    discovered_from:
      name: discovered_from
      in: query
      required: false
      description: Inclusive UTC start day, `YYYY-MM-DD`.
      schema:
        type: string
        format: date
        example: '2026-07-01'
    discovered_to:
      name: discovered_to
      in: query
      required: false
      description: Inclusive UTC end day, `YYYY-MM-DD`.
      schema:
        type: string
        format: date
        example: '2026-07-31'
    source:
      name: source
      in: query
      required: false
      description: Restrict to one source slug, as returned by List Sources.
      schema:
        type: string
        example: gong
    is_user:
      name: is_user
      in: query
      required: false
      description: >-
        `true`: confirmed users only. `false`: checked but not a user. `all`:
        both.
      schema:
        type: string
        enum:
          - all
          - 'true'
          - 'false'
        default: all
  schemas:
    Company:
      type: object
      description: A company (account) Huntd tracks for your organization
      properties:
        domain:
          type: string
          description: >-
            Normalized domain. The stable key: deduplicate and join to
            `companyDomain` on List People with it.
        name:
          type: string
          nullable: true
          description: Company display name.
        size:
          type: integer
          nullable: true
          description: Employee count.
        industry:
          type: string
          nullable: true
          description: Comma-separated industry labels.
        country:
          type: string
          nullable: true
          description: Country.
        people:
          type: integer
          description: How many tracked people you have at this company.
        sources:
          type: array
          items:
            type: string
          description: >-
            Source slugs with at least one confirmed user at this company. Empty
            means we checked and found no user.
        discoveredAt:
          type: string
          format: date-time
          nullable: true
          description: When we last checked this company (UTC).
      example:
        domain: acme.com
        name: Acme
        size: 2100
        industry: banking,financial services
        country: United States
        people: 12
        sources:
          - devin
          - factory
        discoveredAt: '2026-07-31T18:31:58.294Z'
    ApiError:
      type: object
      description: Every error uses this envelope. Branch on `error.code`, not the message.
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - INVALID_PARAMETER
                - INVALID_BODY
                - INVALID_API_KEY
                - ENDPOINT_NOT_ON_PLAN
                - SOURCE_NOT_ALLOWED
                - SUBSCRIPTION_INACTIVE
                - JOB_NOT_FOUND
                - SOURCE_NOT_VERIFIABLE
                - SOURCE_UNAVAILABLE
                - FUNCTION_EXPIRED
                - SOURCE_NEEDS_EMAIL
                - SOURCE_NEEDS_DOMAIN
                - RATE_LIMITED
                - RATE_LIMIT_EXCEEDED
                - QUOTA_EXCEEDED
                - STREAM_FAILED
                - INTERNAL_ERROR
                - ORG_KIND_UNAVAILABLE
            message:
              type: string
              description: Human-readable. May change.
  responses:
    BadRequest:
      description: A query parameter is malformed or out of range
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            limit:
              summary: limit over 1000
              value:
                success: false
                error:
                  code: INVALID_PARAMETER
                  message: '`limit` may not exceed 1000.'
            dates:
              summary: Both date styles given
              value:
                success: false
                error:
                  code: INVALID_PARAMETER
                  message: >-
                    Use either `discovered_days` or
                    `discovered_from`/`discovered_to`, not both.
    Unauthorized:
      description: API key is missing, malformed, unknown or revoked
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            success: false
            error:
              code: INVALID_API_KEY
              message: API key is missing, invalid, or has been revoked.
    ForbiddenRows:
      description: >-
        Not available on your plan, or no access to the requested source, or no
        active subscription
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            notOnPlan:
              summary: Agency key calling an enterprise endpoint
              value:
                success: false
                error:
                  code: ENDPOINT_NOT_ON_PLAN
                  message: >-
                    This endpoint is not available on your plan. Use POST
                    /verify to check an address.
            sourceNotAllowed:
              summary: No access to the requested source
              value:
                success: false
                error:
                  code: SOURCE_NOT_ALLOWED
                  message: Your organization does not have access to source `gong`.
            subscriptionInactive:
              summary: Workspace has no active subscription
              value:
                success: false
                error:
                  code: SUBSCRIPTION_INACTIVE
                  message: >-
                    This workspace doesn't have an active subscription. Please
                    contact your account manager to restore access.
    SourceUnavailable:
      description: The requested source is paused for maintenance
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            success: false
            error:
              code: SOURCE_UNAVAILABLE
              message: Source `gong` is temporarily unavailable for maintenance.
    RateLimited:
      description: Over the API key's per-minute limit
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            success: false
            error:
              code: RATE_LIMIT_EXCEEDED
              message: 'Rate limit exceeded: 60 requests per minute. Retry in 23s.'
      headers:
        Retry-After:
          description: Seconds to wait before the next request.
          schema:
            type: integer
    InternalError:
      description: Internal error. Safe to retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            success: false
            error:
              code: INTERNAL_ERROR
              message: Internal server error.
    PlanUnavailable:
      description: Your plan briefly could not be confirmed. Retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            success: false
            error:
              code: ORG_KIND_UNAVAILABLE
              message: >-
                Your organization's plan could not be checked. Please retry in a
                moment.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key in format: hntd_{id}_{secret}. Create one in Settings → API &
        webhooks. `Authorization: Bearer` is also accepted.

````

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