Skip to navigation

Requests and responses

The structure every request follows and the shape every response returns.
View as Markdown

Every endpoint in the Mitu API shares the same request structure and response shape, so the code your integration uses to call one endpoint and read its result works for every other endpoint without change. This page describes that structure once, and each endpoint page then documents only the parameters and fields specific to it.

Request structure

A request is made up of the endpoint’s versioned path, such as /v1/customers/{id}, appended to the base URL of your environment, together with the headers, parameters and body that the endpoint accepts.

PartDescription
x-api-key headerSent with every request to authenticate it, as described in Authentication.
Content-Type headerSet to application/json on any request that includes a body.
Idempotency-Key headerSent with requests that create something, so they can be retried without being performed twice, as described in Idempotency.
Path parametersIdentify the resource the request acts on, such as the id in /v1/customers/{id}.
Query parametersRefine what a list endpoint returns, through filters and the paging controls described in Pagination.
BodyA JSON object containing the fields documented for the endpoint. Fields the endpoint does not recognise are discarded rather than stored, so a misspelt field name results in that value being ignored.
Request
curl --request POST \
--url https://api.mitu.ai/v1/customers \
--header "x-api-key: $MITU_API_KEY" \
--header "Content-Type: application/json" \
--header "Idempotency-Key: 6f1c2b7e-3d4a-4b8e-9c1f-2a5d7e8b9c0d" \
--data '{
"client_reference_id": "user_8841",
"first_name": "Ada",
"last_name": "Okafor",
"email": "ada@example.com"
}'

Response shape

A successful request returns a 2xx status code, with 201 indicating that a resource was created, and a JSON body that in most cases contains the resource under data alongside a message that summarises the outcome. Endpoints that return a list place their records in a data array accompanied by a meta object for paging, and the exact response of every endpoint, including the few that return their result without the data wrapper, is shown on its own page in this reference.

Response
{
"message": "Customer created successfully",
"data": {
"id": "cus_ds9hazr8jd3l",
"client_reference_id": "user_8841",
"first_name": "Ada",
"last_name": "Okafor",
"email": "ada@example.com"
}
}

The message is written for people reading logs and may be reworded over time, so your integration should rely on the status code and the contents of data rather than on the wording of a message. A request that fails returns a different shape, described in Errors.

Data conventions

The same conventions apply to the data of every resource, so a value returned by one endpoint can be stored, compared and sent to another without conversion.

  1. Identifiers
    Every resource is given an identifier by Mitu, which should be stored with your own record and treated as an opaque string, compared exactly as it was returned rather than parsed or assumed to have a fixed length.
  2. Your own references
    Most resources accept a reference of your own, such as client_reference_id on a customer, so that every Mitu record can be traced back to the record it belongs to in your systems.
  3. Amounts
    Amounts are sent as numbers and returned as decimal strings, such as "25.00", so that no value is ever altered by rounding, with the handling of each currency’s precision described in Amounts and precision.
  4. Currencies
    Currencies are identified by code, such as USD or USDC, with the currencies available to each feature listed in Currencies and networks.
  5. Timestamps
    Dates and times are returned in ISO 8601 format and expressed in UTC, such as 2026-09-11T15:00:34.915Z.
  6. Empty values
    An optional field without a value is returned as null, so every optional field should be handled as one that may be empty.

An integration built on these conventions handles every resource in the API consistently, which means that adopting a new endpoint becomes a matter of mapping its fields rather than writing new code to call it, read its response or interpret its data.