---
search:
  tags:
    - Customers
    - POST
seo:
  description: >-
    Any signed in user. Registers a customer and returns the row as the register
    will… Reference for the POST /api/v1/customers endpoint in the PharmaFlow
    API.
sidebar:
  label: Create a customer
  badge: POST
title: Create a customer
type: openapi-operation
---
Any signed in user. Registers a customer and returns the row as the register will read it. Only name is required, and a negative credit limit is refused with 400 before any write.

`POST /api/v1/customers`

**Request body** (`application/json`, required)

- `name` (string, required)
- `phone` (string)
- `national_id` (string)
- `notes` (string)
- `credit_limit` (number)
- `is_credit_allowed` (boolean)

Request body example:

```json
{
  "name": "string",
  "phone": "",
  "national_id": "",
  "notes": "",
  "credit_limit": 0,
  "is_credit_allowed": false
}
```

**Responses**

- `201` — Customer registered
- `400` — The name is empty or a field fails validation, such as a negative credit limit
- `401` — Not authenticated

Response example, 201:

```json
{
  "id": "string",
  "name": "string",
  "phone": "string",
  "national_id": "string",
  "notes": "string",
  "image_url": "string",
  "credit_limit": "string",
  "current_balance": "string",
  "is_credit_allowed": true,
  "created_at": "string",
  "updated_at": "string",
  "is_deleted": true
}
```
