# Beehiiv Subscriber

## Endpoint

```
POST https://api.crawlbyte.ai/api/tasks
```

## Basic Configuration (Required)

```json
{
  "type": "beehiiv",
  "url": "https://link.beehiiv.com/subscribe",
  "input": [
    "test@example.com",
    "hello@crawlbyte.ai"
  ],
  "multithread": false
}
```

### Parameters

| Field       | Type    | Description                                            |
| ----------- | ------- | ------------------------------------------------------ |
| type        | string  | Always `"beehiiv"`                                     |
| url         | string  | Target Beehiiv subscribe form URL                      |
| input       | array   | Array of emails to be subscribed                       |
| multithread | boolean | Use `true` for faster processing with multiple threads |

## Advanced Configuration (Optional)

```json
{
  "type": "beehiiv",
  "url": "https://link.beehiiv.com/subscribe",
  "input": [
    "test@example.com"
  ],
  "multithread": true,
  "headers": "{\"Authorization\":\"Bearer abc123\",\"X-Custom-Header\":\"value\"}",
  "cookie": "session_id=xyz123; token=abc456",
  "proxy": "http://username:password@ip:port"
}

```

### Optional Parameters

| Field   | Type   | Description                        |
| ------- | ------ | ---------------------------------- |
| headers | string | JSON-formatted string of headers.  |
| cookie  | string | `key=value;`                       |
| proxy   | string | `http://username:password@ip:port` |

## Pricing

* **$0.01 per successful task**\
  This is a pay-as-you-go pricing model — you're only charged when a Beehiiv task successfully submits email addresses.

You can view your current credit balance and usage history in the [Crawlbyte Dashboard](https://dash.crawlbyte.ai/).

## Response

The response object contains metadata about the task, but for `beehiiv` type, the most relevant field is `status`, which determines task progress.

```json
{
  "id": "bd3e89ed-815e-4395-98a3-521ede71cc4d",
  "status": "queued"
}
```

### Status Types

| Status     | Meaning                                                        |
| ---------- | -------------------------------------------------------------- |
| queued     | Task was accepted and added to the processing queue.           |
| processing | Task is currently running.                                     |
| completed  | Task finished successfully (emails were submitted to Beehiiv). |
| failed     | Task encountered an error (e.g. bad proxy, invalid URL, etc.). |

## Polling

If the initial `status` is `queued` or `processing`, you should poll for task completion.

```
GET https://api.crawlbyte.ai/api/tasks/:id
```

* You’ll receive the same structure with an updated `status`.
* Only poll until you receive `completed` or `failed`.
* Recommended interval: **every 3–5 seconds**.

## SDK Usage

You can run this task using any official **Crawlbyte SDK**:

* [Go SDK](https://github.com/crawlbyte/crawlbyte-sdk-go)
* [TypeScript SDK](https://github.com/crawlbyte/crawlbyte-sdk-ts)
* [Python SDK](https://github.com/crawlbyte/crawlbyte-sdk-py)

Each SDK provides a simple way to:

* Create the task
* Poll for status
* Handle the final result

Refer to the [SDKs section](/sdks.md) for installation, examples, and setup instructions.

## Notes

* If you leave advanced settings blank, Crawlbyte will automatically assign optimal headers, user-agent, and fingerprinting.
* `multithread: true` is recommended for faster processing — especially when submitting larger email batches.
* Incorrect `proxy`, malformed `headers`, or invalid `cookie` format will cause the task to fail.
* Only use custom proxy, headers, or cookies if needed — default settings work best in most cases.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.crawlbyte.ai/beehiiv-subscriber.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
