> For the complete documentation index, see [llms.txt](https://docs.shoffi.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shoffi.app/the-shoffi-api/create-new-affiliate.md).

# Create New Affiliate

## Create a new affiliate and get its affiliate link

<mark style="color:green;">`POST`</mark> `https://platform.shoffi.app/API/affiliate/create`

#### Request Body

| Name                                               | Type    | Description               |
| -------------------------------------------------- | ------- | ------------------------- |
| apiKey<mark style="color:red;">\*</mark>           | String  | Your Shoffi app API Key   |
| appId<mark style="color:red;">\*</mark>            | Integer | Your app ID               |
| affiliateDetails<mark style="color:red;">\*</mark> | Object  | Affiliate account details |
| affiliateTerms<mark style="color:red;">\*</mark>   | Object  | Affiliate contract terms  |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "affiliateDetails": {
        "email": "tobias@lutke.com",
        "firstName": "Tobias",
        "lastName": "Lütke",
        "nickName": "tobi"
    },
    "affiliateTerms": {
        "revenueShare": 30,
        "cpi": 10,
        "limitPeriod": 24,
        "minWithdrawal": 50,
        "recurringChargeOnly": true
    },
    "affiliateLink": "https://platform.shoffi.app/r/rl_xxxxxxxx"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "status": 400,
    "message": "Error details"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Please Note!**\
If the email you will send in the POST request is already associated with an affiliate account in Shoffi, we will not create a new account. \
We will update the existing one with a new connection to your app with the affiliate terms you sent. You will still get a "200" response with the relevant data.&#x20;
{% endhint %}

```
curl -X POST \
  https://platform.shoffi.app/API/affiliate/create \
  -H 'Content-Type: application/json' \
  -d '{
    "apiKey": "YourKey",
    "appId": 00000000,
    "affiliateDetails": {
        "email": "tobias@lutke.com",
        "firstName": "Tobias",
        "lastName": "Lütke",
        "nickName": "tobi"
    },
    "affiliateTerms": {
        "revenueShare": 30,
        "cpi": 10,
        "limitPeriod": 24,
        "minWithdrawal": 50,
        "recurringChargeOnly": true
    }
}'
```

## Parameters breakdown

### affiliateDetails

* `email:`\
  The new affiliate email address
* `firstName:`\
  The new affiliate first name
* `lastName:`\
  The new affiliate last name
* `nickName:`\
  The new affiliate nickname

### affiliateTerms

* `revenueShare:`\
  The percentage you are willing to pay the affiliate for every transaction made by a store they referred to. You can read more about [the affiliate commission](/general/the-affiliate-commission.md).
* `cpi:`\
  Cost Per Install. The amount the affiliate will be rewarded for each successful install of the app. You can set the amount to '0' if you are not interested in paying per install.
* `limitPeriod:`\
  The period in which the affiliate will earn commissions from transactions made by the referred store, In months. If not limited, the affiliate will earn commissions as long as the referral is active.
* `minWithdrawal:`\
  The minimum amount an affiliate needs to reach in earnings so they can ask to withdraw their balance. In USD.
* `recurringChargeOnly:`\
  apply affiliate earnings from recurring charges only, excluding one-time fees charged by the app.

## Response example

```json
200 OK
Content-Type: application/json
```

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "affiliateDetails": {
        "email": "tobias@lutke.com",
        "firstName": "Tobias",
        "lastName": "Lütke",
        "nickName": "tobi"
    },
    "affiliateTerms": {
        "revenueShare": 30,
        "cpi": 10,
        "limitPeriod": 24,
        "minWithdrawal": 50,
        "recurringChargeOnly": true
    },
    "affiliateLink": "https://platform.shoffi.app/r/rl_xxxxxxxx"
}
</code></pre>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.shoffi.app/the-shoffi-api/create-new-affiliate.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
