Coinbax API

Controls

View as Markdown

Verify a Twilio SMS code for a transaction

POST/api/v2/controls/twilio-sms/verifyOAuth 2.0 client credentials

Checks a code the recipient received by SMS. v1 called this `verify-twilio-sms`; v2 namespaces it by integration.

Request body

object

Responses

200Verification result
  • idstringrequired
  • platformIdstringrequired
  • userIdstringrequired
  • typeenumrequired"identity" · "document" · "address" · "phone" · "email"
  • statusenumrequired"pending" · "in_progress" · "approved" · "rejected" · "needs_review" · "expired"
  • levelenumrequired"none" · "basic" · "intermediate" · "advanced"
  • riskRatingenum"low" · "medium" · "high" · "very_high"
  • providerobject
    object
  • externalInquiryIdobject
    object
  • externalSessionTokenobject
    object
  • metadataobject
    object
  • rejectionReasonobject
    object
  • verifiedAtobject
    object
  • expiresAtobject
    object
  • createdAtstring (date-time)required
  • updatedAtstring (date-time)required
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "platformId": "550e8400-e29b-41d4-a716-446655440001",
  "userId": "0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed",
  "type": "identity",
  "status": "approved",
  "level": "basic",
  "riskRating": "low",
  "provider": "persona",
  "externalInquiryId": "inq_ABC123",
  "externalSessionToken": "session_token_xyz",
  "metadata": {
    "email": "user@example.com",
    "country": "US"
  },
  "rejectionReason": null,
  "verifiedAt": "2024-01-15T10:30:00Z",
  "expiresAt": "2025-01-15T10:30:00Z",
  "createdAt": "2024-01-15T10:00:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}
400Invalid or expired code
  • successbooleanrequired

    Always `false` on an error response.

  • dataenumrequired

    Always `null` on an error response. Present so success and error bodies share a shape.

    enumnull

    Always `null` on an error response. Present so success and error bodies share a shape.

  • metaErrorResponseMetaDtorequired
    • timestampstringrequired

      ISO 8601 timestamp of the response.

    • requestIdstringrequired

      Request id for this response. Echoes the `X-Request-ID` or `X-Correlation-ID` you sent, whatever its format; when you send neither, the server generates a UUID v4. Quote it when reporting a problem — it is how the request is found in our logs.

    • pathstringrequired

      Request path that produced the error.

    • methodstringrequired

      HTTP method of the request that produced the error.

  • errorApiErrorDtorequired
    • codestringrequired

      Machine-readable error code. Branch on this rather than on `message`, which is free text and may change. Deliberately an open string, NOT a closed enum. Two families of code reach this field: - the status-derived codes in `ErrorCode` (VALIDATION_ERROR, NOT_FOUND, RATE_LIMIT_EXCEEDED, and so on), which `AllExceptionsFilter` assigns from the HTTP status; - domain-specific codes a service sets on the exception it throws, such as `ESCROW_ALREADY_CREATED`, `PRE_ESCROW_PENDING` or `RELEASE_WINDOW_NOT_ELAPSED`. The second family is the larger one, so publishing `ErrorCode` as an enum would make a strict client reject most real error responses. Treat an unrecognised code as its HTTP status.

    • messagestringrequired

      Human-readable description of what went wrong.

    • statusCodenumberrequired

      HTTP status code, repeated here so the body is self-contained.

    • detailsone of

      Structured context for the error, such as per-field validation messages. Shape varies by `code`; treat it as opaque unless you recognise the code.

      • object
        object
      • array of object
        array of object
        object
      • string
        string
    • suggestionstring

      Actionable guidance for fixing the request, intended to be shown to a person. Advice, not data.

{
  "success": false,
  "data": null,
  "meta": {
    "timestamp": "2026-11-06T12:34:56.789Z",
    "requestId": "550e8400-e29b-41d4-a716-446655440000",
    "path": "/api/v1/transactions",
    "method": "POST"
  },
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Request validation failed",
    "statusCode": 400,
    "details": {
      "amount": "must be a positive number"
    },
    "suggestion": "Use one of: base, ethereum"
  }
}
# Exchange the client ID and secret for an access token (requires jq)
ACCESS_TOKEN=$(jq -n '{grant_type: "client_credentials", client_id: env.COINBAX_CLIENT_ID, client_secret: env.COINBAX_CLIENT_SECRET, scope: "write:transactions"}' |
  curl -sS -X POST https://api-staging.coinbax.com/api/v2/oauth/token \
    -H "Content-Type: application/json" \
    -d @- |
  jq -r .data.access_token)

# Call the endpoint with the token
curl -X POST 'https://api-staging.coinbax.com/api/v2/controls/twilio-sms/verify' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
// getPaymentsToken() is the cached client_credentials helper in /docs/api/authentication
const response = await fetch('https://api-staging.coinbax.com/api/v2/controls/twilio-sms/verify', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${await getPaymentsToken()}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({}),
});
const result = await response.json();