Skip to main content

Endpoints

MethodEndpointDescriptionRate Limit
POST/v1/branchCreate a branch60 req/min
GET/v1/branch/listList branches200 req/min
GET/v1/branch/:idGet branch by ID300 req/min
PATCH/v1/branch/:idUpdate a branch60 req/min
DELETE/v1/branch/:idDeactivate a branch30 req/min

Create Branch

Creates a new branch under the authenticated merchant. All API-created branches automatically use the merchant’s bank account for settlements.
POST /v1/branch

Authentication

Requires HMAC authentication with headers:
  • x-api-key: Your API key ID only (e.g., ak_live_xxx)
  • x-timestamp: Current Unix timestamp in milliseconds
  • x-signature: HMAC-SHA256 signature (using derived signing key)

Request Body

FieldTypeRequiredMax LengthDescription
namestringYes255Branch name
codestringYes50Unique code within the merchant
addressstringNo255Street address
citystringNo100City
postalCodestringNo20Postal code
phonestringNo20Contact phone
telegramGroupIdstringNo50Telegram group for notifications

Example Request

curl -X POST "https://api.ceypay.io/v1/branch" \
  -H "Content-Type: application/json" \
  -H "x-api-key: ak_live_abc123" \
  -H "x-timestamp: 1705315800000" \
  -H "x-signature: your_signature_here" \
  -d '{
    "name": "Colombo Main Branch",
    "code": "COL-MAIN",
    "address": "123 Galle Road",
    "city": "Colombo",
    "postalCode": "00300",
    "phone": "+94112345678",
    "telegramGroupId": "-1001234567890"
  }'

Example Response (201 Created)

{
  "id": "550e8400-e29b-41d4-a716-446655440010",
  "merchantId": "merchant_12345",
  "name": "Colombo Main Branch",
  "code": "COL-MAIN",
  "address": "123 Galle Road",
  "city": "Colombo",
  "postalCode": "00300",
  "phone": "+94112345678",
  "telegramGroupId": "-1001234567890",
  "isActive": true,
  "usesMerchantBankAccount": true,
  "createdAt": "2026-04-17T10:30:00.000Z",
  "updatedAt": "2026-04-17T10:30:00.000Z"
}

Error Responses

StatusDescription
400Bad request — validation error
401Unauthorized — invalid HMAC signature
409Conflict — branch code already exists
429Too many requests — rate limit exceeded

List Branches

Retrieves a paginated list of branches for the authenticated merchant. Supports filtering by active status and searching by name or code.
GET /v1/branch/list

Authentication

Requires HMAC authentication with headers:
  • x-api-key: Your API key ID only (e.g., ak_live_xxx)
  • x-timestamp: Current Unix timestamp in milliseconds
  • x-signature: HMAC-SHA256 signature (using derived signing key)

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger20Items per page
searchstringSearch by name or code
isActive"true" | "false"Filter by active status
sortBystringcreated_atSort field
sortOrder"asc" | "desc"descSort direction

Example Request

curl "https://api.ceypay.io/v1/branch/list?page=1&limit=20&isActive=true" \
  -H "x-api-key: ak_live_abc123" \
  -H "x-timestamp: 1705315800000" \
  -H "x-signature: your_signature_here"

Example Response (200 OK)

{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440010",
      "merchantId": "merchant_12345",
      "name": "Colombo Main Branch",
      "code": "COL-MAIN",
      "city": "Colombo",
      "isActive": true,
      "usesMerchantBankAccount": true,
      "createdAt": "2026-04-17T10:30:00.000Z",
      "updatedAt": "2026-04-17T10:30:00.000Z"
    }
  ],
  "meta": {
    "page": 1,
    "limit": 20,
    "totalItems": 5,
    "totalPages": 1
  }
}

Error Responses

StatusDescription
401Unauthorized — invalid HMAC signature
429Too many requests — rate limit exceeded

Get Branch

Retrieves a single branch by ID. Only returns branches belonging to the authenticated merchant.
GET /v1/branch/:id

Authentication

Requires HMAC authentication with headers:
  • x-api-key: Your API key ID only (e.g., ak_live_xxx)
  • x-timestamp: Current Unix timestamp in milliseconds
  • x-signature: HMAC-SHA256 signature (using derived signing key)

Path Parameters

ParameterTypeRequiredDescription
idstring (UUID)YesBranch ID

Example Request

curl "https://api.ceypay.io/v1/branch/550e8400-e29b-41d4-a716-446655440010" \
  -H "x-api-key: ak_live_abc123" \
  -H "x-timestamp: 1705315800000" \
  -H "x-signature: your_signature_here"

Example Response (200 OK)

{
  "id": "550e8400-e29b-41d4-a716-446655440010",
  "merchantId": "merchant_12345",
  "name": "Colombo Main Branch",
  "code": "COL-MAIN",
  "address": "123 Galle Road",
  "city": "Colombo",
  "postalCode": "00300",
  "phone": "+94112345678",
  "telegramGroupId": "-1001234567890",
  "isActive": true,
  "usesMerchantBankAccount": true,
  "createdAt": "2026-04-17T10:30:00.000Z",
  "updatedAt": "2026-04-17T10:30:00.000Z"
}

Error Responses

StatusDescription
401Unauthorized — invalid HMAC signature
403Forbidden — branch belongs to another merchant
404Branch not found
429Too many requests — rate limit exceeded

Update Branch

Updates an existing branch. All fields are optional — only include fields you want to change.
PATCH /v1/branch/:id

Authentication

Requires HMAC authentication with headers:
  • x-api-key: Your API key ID only (e.g., ak_live_xxx)
  • x-timestamp: Current Unix timestamp in milliseconds
  • x-signature: HMAC-SHA256 signature (using derived signing key)

Path Parameters

ParameterTypeRequiredDescription
idstring (UUID)YesBranch ID

Request Body

All fields are optional.
FieldTypeMax LengthDescription
namestring255Branch name
codestring50Unique code within the merchant
addressstring255Street address
citystring100City
postalCodestring20Postal code
phonestring20Contact phone
telegramGroupIdstring50Telegram group for notifications

Example Request

curl -X PATCH "https://api.ceypay.io/v1/branch/550e8400-e29b-41d4-a716-446655440010" \
  -H "Content-Type: application/json" \
  -H "x-api-key: ak_live_abc123" \
  -H "x-timestamp: 1705315800000" \
  -H "x-signature: your_signature_here" \
  -d '{
    "phone": "+94117654321",
    "telegramGroupId": "-1009876543210"
  }'

Example Response (200 OK)

{
  "id": "550e8400-e29b-41d4-a716-446655440010",
  "merchantId": "merchant_12345",
  "name": "Colombo Main Branch",
  "code": "COL-MAIN",
  "address": "123 Galle Road",
  "city": "Colombo",
  "postalCode": "00300",
  "phone": "+94117654321",
  "telegramGroupId": "-1009876543210",
  "isActive": true,
  "usesMerchantBankAccount": true,
  "createdAt": "2026-04-17T10:30:00.000Z",
  "updatedAt": "2026-04-17T11:00:00.000Z"
}

Error Responses

StatusDescription
400Bad request — validation error
401Unauthorized — invalid HMAC signature
404Branch not found
409Conflict — branch code already in use
429Too many requests — rate limit exceeded

Deactivate Branch

Deactivates a branch. This is a soft delete — the branch record and its associated payment history are preserved.
DELETE /v1/branch/:id

Authentication

Requires HMAC authentication with headers:
  • x-api-key: Your API key ID only (e.g., ak_live_xxx)
  • x-timestamp: Current Unix timestamp in milliseconds
  • x-signature: HMAC-SHA256 signature (using derived signing key)

Path Parameters

ParameterTypeRequiredDescription
idstring (UUID)YesBranch ID

Example Request

curl -X DELETE "https://api.ceypay.io/v1/branch/550e8400-e29b-41d4-a716-446655440010" \
  -H "x-api-key: ak_live_abc123" \
  -H "x-timestamp: 1705315800000" \
  -H "x-signature: your_signature_here"

Response (204 No Content)

No response body.

Error Responses

StatusDescription
401Unauthorized — invalid HMAC signature
404Branch not found
429Too many requests — rate limit exceeded

Branch Object

FieldTypeDescription
idUUIDBranch ID
merchantIdUUIDOwning merchant
namestringBranch name
codestringUnique code within the merchant
addressstring?Street address
citystring?City
postalCodestring?Postal code
phonestring?Contact phone
telegramGroupIdstring?Telegram group for notifications
isActivebooleanWhether the branch is active
usesMerchantBankAccountbooleanAlways true for API-created branches
createdAtISO 8601Creation timestamp
updatedAtISO 8601Last update timestamp

Error Responses

StatusErrorDescription
400Bad RequestInvalid request body or validation error
401UnauthorizedInvalid API key or signature
403ForbiddenBranch belongs to another merchant
404Not FoundBranch not found
409ConflictBranch code already exists
429Too Many RequestsRate limit exceeded
See Error Codes for detailed error handling.