# Partner integrations

> How a library or tool sends a Solvecha partner code with the X-Solvecha-Partner header, the partner body field or appId and softId, and the rules for attribution.

If you maintain a library, a plugin or a tool that calls Solvecha, you can join the [partner program](https://solvecha.com/affiliate). Your tool then sends your partner code with each create request. Customers who first reach Solvecha through your tool are tied to your account. You earn a commission on what they pay.

The code is optional. A request without a code works as before.

## Ways to send the code

| Where | Name | Use it for |
|---|---|---|
| Request header | `X-Solvecha-Partner` | Every create request. The best choice. |
| JSON or form body | `partner` | `POST /v1/recognition/*` and `POST /`. Use it when you cannot set headers. |
| `createTask` body | `appId` or `softId` | `POST /createTask`. This is where CapSolver, CapMonster Cloud and 2Captcha clients put their own ids. A number is fine. |
| `in.php` field | `soft_id` | 2Captcha-style `POST /in.php`. |

If both the header and a body field are present, the header wins. A code has at most 128 characters. An unknown or malformed code is ignored. The request still works and is not rejected.

## Examples

```bash
curl -X POST "https://api.solvecha.com/v1/recognition/textcaptcha" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Solvecha-Partner: YOUR_PARTNER_CODE" \
  -H "Content-Type: application/json" \
  -d '{"image_data": ["BASE64_IMAGE"]}'
```

```js
const response = await fetch("https://api.solvecha.com/v1/recognition/textcaptcha", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "X-Solvecha-Partner": "YOUR_PARTNER_CODE",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ image_data: [imageBase64] }),
});
```

```python
import requests

response = requests.post(
    "https://api.solvecha.com/v1/recognition/textcaptcha",
    headers={
        "Authorization": f"Bearer {api_key}",
        "X-Solvecha-Partner": "YOUR_PARTNER_CODE",
    },
    json={"image_data": [image_base64]},
)
```

The same code in the body, for a client that cannot set headers:

```json
{"partner": "YOUR_PARTNER_CODE", "image_data": ["BASE64_IMAGE"]}
```

For a CapSolver-style call, put the code in `appId` or `softId` next to `clientKey`:

```json
{
  "clientKey": "YOUR_API_KEY",
  "appId": "YOUR_PARTNER_CODE",
  "task": {"type": "ImageToTextTask", "body": "BASE64_IMAGE"}
}
```

## How attribution works

- A customer belongs to one partner. The tie is made once and never changes.
- The code in a request only counts for a customer who has no partner yet and has not paid anything yet. A library cannot take over an existing customer who pays already.
- A partner cannot change or move the tie. Only Solvecha staff can correct a mistake, and each correction is logged.
- A customer who signed up with your link (`?ref=` or `/r/`) is tied to you at registration. The code travels in the address (`?ref=`) from your link to the sign-up form; nothing is stored in the visitor's browser, so the customer must sign up in the same visit.
- A customer who uses their own tool with their own code earns nothing for that account. Self-referral is checked and earns nothing. See the [partner terms](https://solvecha.com/affiliate/terms).
- Free tier use and plans that staff granted earn nothing. Only paid, net revenue counts.

## What not to do


> **Warning:**
> Never ship a partner code that is not yours. A code in a library must belong to the person or the company that publishes the library.


- Do not hide the API base URL. Users must be able to see it and to change it.
- Do not send the code from a tool that you do not control or on behalf of other people's accounts.
- Do not pay or reward users to create accounts through your tool.
- Say in the README that your tool contains a partner code, and where it goes. For example: "This library sends the maintainer's Solvecha partner code. The maintainer earns a commission."
- Keep the code in one visible place, for example one constant or one setting, so users can remove it.

## How to join

1. Create a Solvecha account and confirm your e-mail address.
2. Open the [partner page](https://solvecha.com/partner) and apply. Staff approve each application.
3. Copy your partner code and your links from the partner dashboard.

The rate, the term, the payout rules and the conduct rules are in the [partner terms](https://solvecha.com/affiliate/terms). The short version is on the [partner program page](https://solvecha.com/affiliate).
