Branches Endpoints

Manage hospital branch locations and information

Overview

The Branches API allows you to retrieve and create branch locations for your hospital. Each branch can have its own contact numbers, operating hours, and location details.

API Endpoints

GEThttps://server.nyraai.io/api/external/branches

List all branches with filtering and pagination

Permission: branches:read

Headers

x-api-keyrequired

API key

x-api-secretrequired

API secret

Authorizationrequired

Bearer hospital token

Query Parameters

page(integer)

Page number (default: 1)

limit(integer)

Records per page (default: 20, max: 100)

q(string)

Search on name or location

status(string)

Filter by status (ACTIVE, INACTIVE)

Response

{
  "success": true,
  "data": {
    "total": 1,
    "results": [
      {
        "id": "branch-uuid",
        "hospital_id": "hospital-uuid",
        "name": "Main Branch",
        "location": "Kukatpally",
        "landmark": "Near Metro",
        "caller_number": "9876543210",
        "outbound_number": "9876543211",
        "status": "ACTIVE",
        "operating_hours": [
          {
            "day_of_week": 1,
            "is_open": true,
            "start_time": "09:00:00",
            "end_time": "18:00:00"
          }
        ],
        "created_at": "2026-04-08T08:10:00.000Z",
        "updated_at": "2026-04-08T08:10:00.000Z"
      }
    ],
    "page": 1,
    "limit": 20,
    "total_pages": 1
  }
}
POSThttps://server.nyraai.io/api/external/branches

Create a new branch location

Permission: branches:create

Headers

x-api-keyrequired

API key

x-api-secretrequired

API secret

Authorizationrequired

Bearer hospital token

Content-Typerequired

application/json

Request Body

{
  "name": "Main Branch",
  "location": "Kukatpally",
  "landmark": "Near Metro",
  "caller_number": "9876543210",
  "outbound_number": "9876543211",
  "status": "ACTIVE",
  "operating_hours": [
    {
      "day_of_week": 1,
      "is_open": true,
      "start_time": "09:00:00",
      "end_time": "18:00:00"
    },
    {
      "day_of_week": 2,
      "is_open": true,
      "start_time": "09:00:00",
      "end_time": "18:00:00"
    }
  ]
}

Response

{
  "success": true,
  "message": "Branch created successfully",
  "data": {
    "id": "branch-uuid",
    "name": "Main Branch",
    "location": "Kukatpally",
    "status": "ACTIVE"
  }
}

Important Notes

Required Fields

  • name - Branch name (required)

Phone Number Validation

Both caller_number and outbound_number must be valid 10-digit numbers.

Branch-Scoped Keys

Branch-scoped API keys cannot create branches. Only hospital-wide keys can create new branches.

Operating Hours

Operating hours are optional. day_of_week uses 0-6 format (0 = Sunday, 6 = Saturday).

Usage Examples

List All Branches

curl -X GET "https://server.nyraai.io/api/external/branches?page=1&limit=20" \
  -H "x-api-key: nyra_..." \
  -H "x-api-secret: secret..." \
  -H "Authorization: Bearer token..."

Search Branches by Location

curl -X GET "https://server.nyraai.io/api/external/branches?q=kukatpally&status=ACTIVE" \
  -H "x-api-key: nyra_..." \
  -H "x-api-secret: secret..." \
  -H "Authorization: Bearer token..."

Create a New Branch

curl -X POST "https://server.nyraai.io/api/external/branches" \
  -H "x-api-key: nyra_..." \
  -H "x-api-secret: secret..." \
  -H "Authorization: Bearer token..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Main Branch",
    "location": "Kukatpally",
    "landmark": "Near Metro Station",
    "caller_number": "9876543210",
    "outbound_number": "9876543211",
    "status": "ACTIVE",
    "operating_hours": [
      {
        "day_of_week": 1,
        "is_open": true,
        "start_time": "09:00:00",
        "end_time": "18:00:00"
      },
      {
        "day_of_week": 2,
        "is_open": true,
        "start_time": "09:00:00",
        "end_time": "18:00:00"
      }
    ]
  }'

Day of Week Reference

Sunday

0

Monday

1

Tuesday

2

Wednesday

3

Thursday

4

Friday

5

Saturday

6