Skip to content
PharmaFlow Knowledgebase
Esc
↑↓navigate↵open⌘Jpreview

Create a customer

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
Authorization
AuthorizationBearer token (JWT) · headerrequired

JWT from POST /api/v1/auth/login sent as Authorization Bearer.

Request body
requiredapplication/json
namestringrequired
min length 1
phonestring
default: ""
national_idstring
default: ""
notesstring
default: ""
credit_limitnumber
min 0 · default: 0
is_credit_allowedboolean
default: false
Responses
201

Customer registered

idstringrequired
namestringrequired
phonestringrequired
national_idstringrequired
notesstringrequired
image_urlstringrequired
credit_limitstringrequired
current_balancestringrequired
is_credit_allowedbooleanrequired
created_atstringrequired
updated_atstringrequired
is_deletedbooleanrequired
400

The name is empty or a field fails validation, such as a negative credit limit

detailstringrequired
401

Not authenticated

detailstringrequired
Try it
Server
Authorization
Bodyapplication/json
Request
curl -X POST 'http://localhost:8000/api/v1/customers' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "phone": "",
  "national_id": "",
  "notes": "",
  "credit_limit": 0,
  "is_credit_allowed": false
}'
Response
{
  "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
}