# Create / easy.affiliate REST-API (Orders)

### 📝 Introduction

A REST-compliant web service is available to automatically create new orders within the easy.affiliate system. New transactions can be transmitted using the HTTP **POST** method. For this purpose, each user receives an authentication token and a login ID, which can be viewed in the frontend.

---

### 🔐 Authentication

The following headers are required to access the API:

<table data-path-to-node="7" id="bkmrk-header-description-t"><thead><tr><td>**Header**</td><td>**Description**</td><td>**Type**</td></tr></thead><tbody><tr><td><span data-path-to-node="7,1,0,0">**Content-Type**</span></td><td><span data-path-to-node="7,1,1,0">Must be set to `application/json`</span></td><td><span data-path-to-node="7,1,2,0">String</span></td></tr><tr><td><span data-path-to-node="7,2,0,0">**X-Network-ID**</span></td><td><span data-path-to-node="7,2,1,0">Network ID: typically `-1` for cross-client (multi-tenant) API</span></td><td><span data-path-to-node="7,2,2,0">Integer</span></td></tr><tr><td><span data-path-to-node="7,3,0,0">**X-Auth-Token**</span></td><td><span data-path-to-node="7,3,1,0">Your API token (visible in the frontend)</span></td><td><span data-path-to-node="7,3,2,0">String</span></td></tr><tr><td><span data-path-to-node="7,4,0,0">**X-Auth-ID**</span></td><td><span data-path-to-node="7,4,1,0">Your login ID (visible in the frontend)</span></td><td><span data-path-to-node="7,4,2,0">Integer</span></td></tr></tbody></table>

---

### 📩 Endpoints

- **Admin:** `https://DOMAIN.de/ws/V6/admin/JSON/Orders`
- **Advertiser:** `https://DOMAIN.de/ws/V6/advertiser/JSON/Orders`

---

### 🧪 Example (cURL)

<div _ngcontent-ng-c1630465722="" class="code-block ng-tns-c1630465722-43 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" id="bkmrk-bash" jslog="223238;track:impression,attention;BardVeMetadataKey:[["r_41c0f5ad5cc76f47","c_5229d7aaa2a28b5d",null,"rc_c10d37afb03bf2aa",null,null,"en",null,1,null,null,1,0]]"><div _ngcontent-ng-c1630465722="" class="code-block-decoration header-formatted gds-title-s ng-tns-c1630465722-43 ng-star-inserted"><span class="ng-tns-c1630465722-43">Bash</span><div _ngcontent-ng-c1630465722="" class="buttons ng-tns-c1630465722-43 ng-star-inserted"><button aria-label="Code herunterladen" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-mdc-tooltip-trigger download-button ng-tns-c1630465722-43 mat-unthemed ng-star-inserted"></button><button aria-label="Code kopieren" class="mdc-icon-button mat-mdc-icon-button mat-mdc-button-base mat-mdc-tooltip-trigger copy-button ng-tns-c1630465722-43 mat-unthemed ng-star-inserted"></button></div></div><div _ngcontent-ng-c1630465722="" class="formatted-code-block-internal-container ng-tns-c1630465722-43"><div _ngcontent-ng-c1630465722="" class="animated-opacity ng-tns-c1630465722-43"></div></div></div>```
curl -X POST \
  -H "Content-Type: application/json" \
  -H "X-Network-ID: -1" \
  -H "X-Auth-Token: ADMIN_APIUSER_TOKEN" \
  -H "X-Auth-ID: ADMIN_APIUSER_LOGIN_ID" \
  -d '[{
    "ordertoken": "testorder001",
    "campaign_id": 1,
    "trigger_id": 2,
    "status": 1,
    "turnover": 199.99,
    "commission": 20.00
  }]' \
  https://SUBDOMAIN.de/ws/V6/admin/JSON/Orders

```

<div _ngcontent-ng-c1630465722="" class="code-block ng-tns-c1630465722-43 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation" id="bkmrk--4" jslog="223238;track:impression,attention;BardVeMetadataKey:[["r_41c0f5ad5cc76f47","c_5229d7aaa2a28b5d",null,"rc_c10d37afb03bf2aa",null,null,"en",null,1,null,null,1,0]]"><div _ngcontent-ng-c1630465722="" class="formatted-code-block-internal-container ng-tns-c1630465722-43"><div _ngcontent-ng-c1630465722="" class="animated-opacity ng-tns-c1630465722-43"></div></div></div>---

### 🧾 Body Parameters

<table data-path-to-node="13" id="bkmrk-parameter-descriptio"><thead><tr><td>**Parameter**</td><td>**Description**</td><td>**Data Type**</td><td>**Required**</td></tr></thead><tbody><tr><td>`<span data-path-to-node="13,1,0,0"><strong data-index-in-node="0" data-path-to-node="13,1,0,0">ordertoken</strong></span>`</td><td><span data-path-to-node="13,1,1,0">Unique identifier for the order. Must be system-wide unique.</span></td><td><span data-path-to-node="13,1,2,0">String</span></td><td><span data-path-to-node="13,1,3,0">✅ Yes</span></td></tr><tr><td>`<span data-path-to-node="13,2,0,0"><strong data-index-in-node="0" data-path-to-node="13,2,0,0">campaign_id</strong></span>`</td><td><span data-path-to-node="13,2,1,0">ID of the campaign to which the order is assigned.</span></td><td><span data-path-to-node="13,2,2,0">Integer</span></td><td><span data-path-to-node="13,2,3,0">✅ Yes</span></td></tr><tr><td>`<span data-path-to-node="13,3,0,0"><strong data-index-in-node="0" data-path-to-node="13,3,0,0">trigger_id</strong></span>`</td><td><span data-path-to-node="13,3,1,0">ID of the trigger, which is mandatory when using `ordertoken`.</span></td><td><span data-path-to-node="13,3,2,0">Integer</span></td><td><span data-path-to-node="13,3,3,0">✅ Yes</span></td></tr><tr><td>`<span data-path-to-node="13,4,0,0"><strong data-index-in-node="0" data-path-to-node="13,4,0,0">status</strong></span>`</td><td><span data-path-to-node="13,4,1,0">Status of the order: `0` = open, `1` = confirmed, `2` = canceled</span></td><td><span data-path-to-node="13,4,2,0">Integer</span></td><td><span data-path-to-node="13,4,3,0">✅ Yes</span></td></tr><tr><td>`<span data-path-to-node="13,5,0,0"><strong data-index-in-node="0" data-path-to-node="13,5,0,0">turnover</strong></span>`</td><td><span data-path-to-node="13,5,1,0">Order value in campaign currency</span></td><td><span data-path-to-node="13,5,2,0">Float</span></td><td><span data-path-to-node="13,5,3,0">✅ Yes</span></td></tr><tr><td>`<span data-path-to-node="13,6,0,0"><strong data-index-in-node="0" data-path-to-node="13,6,0,0">original_turnover</strong></span>`</td><td><span data-path-to-node="13,6,1,0">Order value in foreign currency</span></td><td><span data-path-to-node="13,6,2,0">Float</span></td><td><span data-path-to-node="13,6,3,0">No</span></td></tr><tr><td>`<span data-path-to-node="13,7,0,0"><strong data-index-in-node="0" data-path-to-node="13,7,0,0">commission</strong></span>`</td><td><span data-path-to-node="13,7,1,0">Commission value in campaign currency. Can be passed if calculated manually.</span></td><td><span data-path-to-node="13,7,2,0">Float</span></td><td><span data-path-to-node="13,7,3,0">No</span></td></tr><tr><td>`<span data-path-to-node="13,8,0,0"><strong data-index-in-node="0" data-path-to-node="13,8,0,0">cancel_reason</strong></span>`</td><td><span data-path-to-node="13,8,1,0">Specifies a reason for cancellation if status = `2` (canceled)</span></td><td><span data-path-to-node="13,8,2,0">String</span></td><td><span data-path-to-node="13,8,3,0">No</span></td></tr></tbody></table>

---

### 📘 Notes

Important implementation details:

- **ordertoken:** Must be **unique** – ideally a combination of a timestamp, shop ID, or external order number.
- **trigger\_id:** If you do not know this ID, check your campaign configuration in the frontend.
- **Bulk Actions:** You can also create multiple orders at once by sending them within a single array.
- **Updates:** If an order with the same `ordertoken` already exists in the system, a **PUT request** can be used to update it.