> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aeoral.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create, Update, and Delete Shiipp Customer Records

> POST, PUT, DELETE /api/ManageCustomers.php — create, update, and delete customer profiles with role-scoped access and duplicate user code prevention.

The **ManageCustomers** endpoint provides create, update, and delete access to customer profiles in your Shiipp account. All operations are scoped to the authenticated user's role — courier users can only access and modify customers within their own organization.

## Endpoint

```
/api/ManageCustomers.php
```

**Authentication:** JWT Bearer token required for all methods.

```
Authorization: Bearer <your_token>
```

***

## POST — Create a Customer

Create a new customer record. Returns a `409 Conflict` if the provided `user_code` already exists within the courier account.

### Request Body

<ParamField body="user_code" type="string" required>
  A unique identifier for the customer within the courier account (e.g., `"CUST001"`).
</ParamField>

<ParamField body="first_name" type="string" required>
  Customer's first name.
</ParamField>

<ParamField body="last_name" type="string" required>
  Customer's last name.
</ParamField>

<ParamField body="branch" type="string">
  The branch or pickup location to assign this customer to.
</ParamField>

<ParamField body="is_active" type="integer" default="1">
  Whether the customer is active. Pass `1` for active, `0` for inactive.
</ParamField>

<ParamField body="courier_id" type="string">
  The courier organization to assign this customer to. **Required for admin and manager roles.** Courier role users have this field auto-set to their own account.
</ParamField>

### Example Request

<CodeGroup>
  ```json JSON Body theme={null}
  {
    "user_code": "CUST042",
    "first_name": "Alicia",
    "last_name": "Thompson",
    "branch": "Kingston",
    "is_active": 1
  }
  ```

  ```bash cURL theme={null}
  curl -X POST https://app.shiipp.com/api/ManageCustomers.php \
    -H "Authorization: Bearer <your_token>" \
    -H "Content-Type: application/json" \
    -d '{
      "user_code": "CUST042",
      "first_name": "Alicia",
      "last_name": "Thompson",
      "branch": "Kingston",
      "is_active": 1
    }'
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "status": "success",
  "message": "Customer profile created",
  "data": {
    "id": "cust-new-uuid"
  }
}
```

<Warning>
  If a customer with the same `user_code` already exists in the courier account, the API returns `409 Conflict`. Use the [PUT method](#put--update-a-customer) to update an existing record, or the [Upload Customers](/api-reference/customers/upload) endpoint for upsert behaviour in bulk.
</Warning>

***

## PUT — Update a Customer

Update one or more fields on an existing customer record. Only the fields you include in the request body are changed.

### Request Body

<ParamField body="courier_customer_id" type="string" required>
  The UUID of the customer record to update.
</ParamField>

<ParamField body="user_code" type="string">
  Update the customer's unique user code.
</ParamField>

<ParamField body="first_name" type="string">
  Update the customer's first name.
</ParamField>

<ParamField body="last_name" type="string">
  Update the customer's last name.
</ParamField>

<ParamField body="branch" type="string">
  Update the customer's assigned branch.
</ParamField>

<ParamField body="is_active" type="integer">
  Set to `1` to activate or `0` to deactivate the customer.
</ParamField>

### Example Request

<CodeGroup>
  ```json JSON Body theme={null}
  {
    "courier_customer_id": "cust-uuid",
    "branch": "Montego Bay",
    "is_active": 0
  }
  ```

  ```bash cURL theme={null}
  curl -X PUT https://app.shiipp.com/api/ManageCustomers.php \
    -H "Authorization: Bearer <your_token>" \
    -H "Content-Type: application/json" \
    -d '{
      "courier_customer_id": "cust-uuid",
      "branch": "Montego Bay",
      "is_active": 0
    }'
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "status": "success",
  "message": "Profile updated successfully."
}
```

***

## DELETE — Remove a Customer

Permanently delete a customer record. This action cannot be undone.

You can identify the target customer using either method:

<Tabs>
  <Tab title="Query Parameter">
    Pass the customer UUID as a query string parameter:

    ```
    DELETE /api/ManageCustomers.php?id=cust-uuid
    ```
  </Tab>

  <Tab title="Request Body">
    Pass the customer UUID in the request body:

    ```json theme={null}
    {
      "courier_customer_id": "cust-uuid"
    }
    ```
  </Tab>
</Tabs>

### Response

```json theme={null}
{
  "status": "success",
  "message": "Customer removed from system."
}
```

<Warning>
  Deleting a customer does not delete their associated packages. Package records retain the customer's name and user code as stored values at the time of intake.
</Warning>

***

## Role-Based Access

<Note>
  **Courier role users** can only create, update, and delete customers within their own courier organization. Admin and manager roles have cross-courier access and must pass `courier_id` when creating customers.
</Note>

| Operation              | Courier Role          | Manager Role | Admin Role  |
| ---------------------- | --------------------- | ------------ | ----------- |
| Create customer        | Own account only      | Any courier  | Any courier |
| Update customer        | Own account only      | Any courier  | Any courier |
| Delete customer        | Own account only      | Any courier  | Any courier |
| Filter by `courier_id` | Ignored (auto-scoped) | Supported    | Supported   |
