Create Branch
Add a new branch with all details
Reading time: 1 minute
Create New Branch
Add a new branch with all details.
POST
{{base_url}}/branchesQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
phone_number_id | string | Yes | Phone number ID |
Request Body (form-data)
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
name | string | Yes | Branch name (max 255 characters) | - |
phone | string | No | Branch phone number | - |
email | string | No | Branch email address | - |
address | string | No | Full branch address | - |
description | string | No | Branch description | - |
branch_id | string | No | External branch ID (for integration with other systems) | - |
contact_group_id | string | No | Contact group ID | - |
full_name | string | No | Full name of branch manager | - |
is_favorite | boolean | No | Mark as favorite branch | false |
file | file | No | Attachment file (logo, image - max 10MB) | - |
File Requirements:
- Maximum size: 10 MB
- Supported formats: JPG, PNG, PDF
- Recommended format: PNG with dimensions 512x512
Example Request
Example Requestbash
curl -X POST "{{base_url}}/branches?phone_number_id=123456" \
-H "Accept: application/json" \
-H "X-Awal-Signature-256: sha256=abc..." \
-H "X-Timestamp: 1704124800" \
-H "X-Domain: your-workspace" \
-H "X-Client-ID: your-client-id" \
-F "name=Khobar Branch" \
-F "phone=966500000002" \
-F "email=khobar@example.com" \
-F "address=Corniche, Khobar, Saudi Arabia" \
-F "description=New branch in Khobar" \
-F "is_favorite=false" \
-F "file=@/path/to/branch-logo.png"Example Response
Response200 OK
{
"status": true,
"message": "Branch created successfully",
"data": {
"id": 3,
"name": "Khobar Branch",
"phone": "966500000002",
"email": "khobar@example.com",
"address": "Corniche, Khobar, Saudi Arabia",
"description": "New branch in Khobar",
"is_favorite": false,
"file_url": "https://storage.awalchat.com/branches/3/logo.png",
"created_at": "2025-01-08T15:00:00Z"
}
}Use Case: Create Branch with Contact Group
Create with Groupbash
POST /branches?phone_number_id=123456
-F "name=Dammam Branch"
-F "contact_group_id=5"Error Codes
| Code | Description | Cause | Solution |
|---|---|---|---|
| 400 | Bad Request | Invalid data | Check sent data |
| 409 | Conflict | Duplicate branch name | Use a different name |
| 413 | Payload Too Large | File size too large | Use file smaller than 10MB |
| 422 | Validation Error | Validation error | Review error message |
Related
ā Back to Branches
View Guide