> For the complete documentation index, see [llms.txt](https://api.senderwiz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.senderwiz.com/customer/subscribers/create-or-update-a-subscriber.md).

# Create or Update a Subscriber

### 🔁 Create or Update a Subscriber

If the subscriber exists, their details will be updated. If not, a new subscriber will be created.

***

#### 🔹 HTTP Request

**Step 1 (Search):**

```http
GET API-URL/lists/LIST-UNIQUE-ID/subscribers/search-by-email
```

**Step 2 (Update if exists):**

```http
PUT API-URL/lists/LIST-UNIQUE-ID/subscribers/SUBSCRIBER-UNIQUE-ID
```

**Step 3 (Create if new):**

```http
POST API-URL/lists/LIST-UNIQUE-ID/subscribers
```

***

#### 🔸 URL Segments

| Segment                | Required | Description                              |
| ---------------------- | -------- | ---------------------------------------- |
| `LIST-UNIQUE-ID`       | Yes      | List unique identifier                   |
| `SUBSCRIBER-UNIQUE-ID` | Yes      | Subscriber UID if found via email search |

***

#### 🔎 GET/PUT/POST Parameters

| Parameter | Type   | Required | Description                                  |
| --------- | ------ | -------- | -------------------------------------------- |
| `EMAIL`   | string | Yes      | Email address used to identify subscriber    |
| `data`    | array  | Yes      | Fields to update or insert `{name => value}` |

***

#### 🔐 Authorization Header

```
X-API-KEY: your-api-key-here
```

***

#### 💻 PHP Example

```php
// CREATE / UPDATE EXISTING SUBSCRIBER
$response = $endpoint->createUpdate('LIST-UNIQUE-ID', [
    'EMAIL'    => 'sophia.lane@demo.net',
    'FNAME'    => 'Sophia',
    'LNAME'    => 'Lane Updated Again'
]);

// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';
```

***

#### 📦 Sample JSON Response

```json
{
  "status":"success",
  "data": {
    "record": {
      "subscriber_uid": "zl239xm3df771",
      "email": "sophia.lane@demo.net",
      "ip_address": "192.168.1.100",
      "source": "api",
      "date_added": "2025-04-17 14:38:00"
    }
  }
}
```
