For the complete documentation index, see llms.txt. This page is also available as Markdown.

Status Code

Every API request returns an HTTP status code indicating whether the request was successfully processed.

A successful request returns a 2xx status code, while invalid requests, authentication failures, validation errors, or server-side issues return 4xx or 5xx responses.

In addition to the HTTP status code, Segment Ledgers returns a standardized JSON response body containing detailed information about the result of the request.

Response Format

All API responses follow a consistent structure.

Successful Response

{
  "statusCode": 200,
  "statusMessage": "Success",
  "payload": {
    ...
  }
}

Error Response

{
  "statusCode": 400,
  "statusMessage": "Validation Error",
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "ledger_id is required"
  }
}

HTTP Status Codes

Status Code
Name
Description

200

OK

The request completed successfully.

201

Created

A new resource was successfully created.

202

Accepted

The request has been accepted for processing.

204

No Content

The request completed successfully and no response body is returned.

400

Bad Request

The request is invalid or contains missing or malformed parameters.

401

Unauthorized

Authentication failed or no API key was provided.

403

Forbidden

The authenticated client does not have permission to access the requested resource.

404

Not Found

The requested resource does not exist.

409

Conflict

The request conflicts with the current state of the resource (for example, duplicate idempotency key).

422

Unprocessable Entity

The request is syntactically valid but contains invalid business data.

429

Too Many Requests

Rate limit exceeded. Retry after the specified interval.

500

Internal Server Error

An unexpected server error occurred.

503

Service Unavailable

The service is temporarily unavailable or undergoing maintenance.

Success Responses

200 OK

Returned when a request completes successfully.

Example

201 Created

Returned after successfully creating a new resource.

Example


202 Accepted

Returned when a request has been accepted but processing has not yet completed.

This is commonly used for asynchronous operations.


204 No Content

Returned when an operation succeeds but no response body is required.

Typical examples include:

  • Delete operations

  • Some update operations


Client Errors (4xx)

Client errors indicate that the request cannot be processed due to invalid input, authentication failures, or insufficient permissions.


400 Bad Request

Returned when the request is malformed or required parameters are missing.

Common Causes

  • Missing required fields

  • Invalid JSON

  • Incorrect parameter format

  • Invalid UUID

  • Unsupported query parameter

Example


401 Unauthorized

Returned when authentication credentials are missing or invalid.

Common Causes

  • Missing Authorization header

  • Invalid API key

  • Expired API key

  • Invalid signature

Example


403 Forbidden

Returned when authentication succeeds but access to the resource is denied.

Example


404 Not Found

Returned when the requested resource cannot be found.

Example


409 Conflict

Returned when the request conflicts with an existing resource or operation.

Examples include:

  • Duplicate idempotency key

  • Duplicate account identifier

  • Transaction already processed

Example


422 Unprocessable Entity

Returned when validation succeeds but business rules prevent the operation.

Examples include:

  • Insufficient balance

  • Currency mismatch

  • Invalid transaction state

  • Closed account

  • Unsupported account type

Example


429 Too Many Requests

Returned when the client exceeds the permitted API request rate.

The response may include a Retry-After header indicating how long to wait before retrying.

Example


Server Errors (5xx)

Server errors indicate that the request was valid but could not be completed due to an unexpected problem within Segment Ledgers.


500 Internal Server Error

Returned when an unexpected server-side error occurs.


503 Service Unavailable

Returned when the service is temporarily unavailable due to maintenance or temporary capacity issues.

Last updated