> This page is for BaaS.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.api.corpx.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.api.corpx.com/_mcp/server.

# Verify a request signature (self-test)

POST https://tenant.api.corpx.com/v1/security/signature/verify
Content-Type: application/json

Rebuilds the canonical string from what you send and verifies the
detached JWS against the **caller's own** public keys. Use it to get your
signing implementation right before the first real transaction.

Always answers `200` (except on a malformed body), including when the
signature is invalid: a `401` here would be indistinguishable from "your
token expired" and would send you debugging the wrong thing. Creates
nothing and moves nothing.


Reference: https://docs.api.corpx.com/baas/referencia/security/verify-request-signature

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Headers

- `X-Tenant-Id` (string, required) — Tenant context used for authorization and routing.
- `Idempotency-Key` (string, optional) — Optional client-generated idempotency token (recommended for safe retries).

### Body (application/json)

This endpoint expects an object.

- `path` (string, required) — Path including the query string, no host.
- `method` (string, optional) — HTTP method of the hypothetical request. Defaults to `POST`.
- `timestamp` (string, optional) — Unix seconds, same value as `X-Request-Timestamp`.
- `idempotencyKey` (string, optional) — Value of `Idempotency-Key`, or empty when the route has none.
- `contentSha256` (string, optional) — Lowercase hex SHA-256 of the body. Omit and we compute it from `body` — that is the step most integrators get wrong.
- `body` (string, optional) — Raw body of the hypothetical request, as a string.
- `signature` (string, optional) — Detached JWS `<protected>..<signature>`.

## Response

### 200

Verification result (including failures).

- `valid` (boolean, required)
- `canonicalString` (string, required) — The exact string the server signed over. Compare it with yours.
- `reason` (string, optional) — Present only when `valid` is false. One of `request_signature_invalid`, `request_timestamp_skew`, `unknown_kid`, `body_hash_mismatch`, `signature_missing`, `no_credential`, `no_public_key`.
- `message` (string, optional)
- `expectedContentSha256` (string, optional)
- `signedHost` (string, optional)
- `maxSkewSeconds` (integer, optional)
- `usableKids` (list of string, optional) — Keys currently usable by this credential (past their grace period).
- `kid` (string, optional)
- `alg` (enum, optional)
  - Allowed values: `ES256`, `PS256`
- `edgeReason` (string, optional) — Present when the signed-host edge would have refused this same call and let it through only because it is the self-test. One of `request_timestamp_skew`, `request_signature_invalid`, `unknown_kid`, `request_signature_required`, `credential_not_yet_active`. Absent when the edge accepted the signature.
- `activeFrom` (datetime, optional) — Present while the credential is still in its activation grace. Until this instant every other route refuses it with `credential_not_yet_active`.

## Errors

### 400 Bad Request Error

Invalid request sent by client.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

### 500 Internal Server Error

Unexpected server error.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

## Types

### ErrorResponsePartner

Raw error from the settlement bank, when the failure came from it. Diagnostic only.

- `code` (string, optional)
- `message` (string, optional)
- `field` (string, optional) — Field the partner pointed at, when any.

## Examples

**Request**

```json
{
  "path": "/v1/accounts/acc-123/pix/payments",
  "method": "POST",
  "timestamp": "1789412400",
  "idempotencyKey": "9a5f8c2e-1b3d-4e6f-8a7b-0c1d2e3f4a5b",
  "contentSha256": "3f9a2b1c0d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a",
  "body": "{\"ok\":true}",
  "signature": "MEUCIQDx...base64url"
}
```

**Response**

```json
{
  "valid": true,
  "canonicalString": "POST\n/v1/accounts/2e6b725b-84a0-400d-8740-22a5ba0f23e6/pix/out\n\n3f9a2b1c...\n1770000000",
  "reason": "Pagamento pedido #12345",
  "message": "Pagamento pedido #12345",
  "expectedContentSha256": "3f9a2b1c0d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a",
  "signedHost": "client.api.corpx.com",
  "maxSkewSeconds": 300,
  "usableKids": [
    "string"
  ],
  "kid": "sha256:3f9a2b1c0d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a",
  "alg": "ES256"
}
```

**SDK Code**

```python Security_verifyRequestSignature_example
import requests

url = "https://tenant.api.corpx.com/v1/security/signature/verify"

payload = {
    "path": "/v1/accounts/acc-123/pix/payments",
    "method": "POST",
    "timestamp": "1789412400",
    "idempotencyKey": "9a5f8c2e-1b3d-4e6f-8a7b-0c1d2e3f4a5b",
    "contentSha256": "3f9a2b1c0d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a",
    "body": "{\"ok\":true}",
    "signature": "MEUCIQDx...base64url"
}
headers = {
    "X-Tenant-Id": "X-Tenant-Id",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Security_verifyRequestSignature_example
const url = 'https://tenant.api.corpx.com/v1/security/signature/verify';
const options = {
  method: 'POST',
  headers: {
    'X-Tenant-Id': 'X-Tenant-Id',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"path":"/v1/accounts/acc-123/pix/payments","method":"POST","timestamp":"1789412400","idempotencyKey":"9a5f8c2e-1b3d-4e6f-8a7b-0c1d2e3f4a5b","contentSha256":"3f9a2b1c0d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a","body":"{\"ok\":true}","signature":"MEUCIQDx...base64url"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Security_verifyRequestSignature_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://tenant.api.corpx.com/v1/security/signature/verify"

	payload := strings.NewReader("{\n  \"path\": \"/v1/accounts/acc-123/pix/payments\",\n  \"method\": \"POST\",\n  \"timestamp\": \"1789412400\",\n  \"idempotencyKey\": \"9a5f8c2e-1b3d-4e6f-8a7b-0c1d2e3f4a5b\",\n  \"contentSha256\": \"3f9a2b1c0d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a\",\n  \"body\": \"{\\\"ok\\\":true}\",\n  \"signature\": \"MEUCIQDx...base64url\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Tenant-Id", "X-Tenant-Id")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Security_verifyRequestSignature_example
require 'uri'
require 'net/http'

url = URI("https://tenant.api.corpx.com/v1/security/signature/verify")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Tenant-Id"] = 'X-Tenant-Id'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"path\": \"/v1/accounts/acc-123/pix/payments\",\n  \"method\": \"POST\",\n  \"timestamp\": \"1789412400\",\n  \"idempotencyKey\": \"9a5f8c2e-1b3d-4e6f-8a7b-0c1d2e3f4a5b\",\n  \"contentSha256\": \"3f9a2b1c0d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a\",\n  \"body\": \"{\\\"ok\\\":true}\",\n  \"signature\": \"MEUCIQDx...base64url\"\n}"

response = http.request(request)
puts response.read_body
```

```java Security_verifyRequestSignature_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://tenant.api.corpx.com/v1/security/signature/verify")
  .header("X-Tenant-Id", "X-Tenant-Id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"path\": \"/v1/accounts/acc-123/pix/payments\",\n  \"method\": \"POST\",\n  \"timestamp\": \"1789412400\",\n  \"idempotencyKey\": \"9a5f8c2e-1b3d-4e6f-8a7b-0c1d2e3f4a5b\",\n  \"contentSha256\": \"3f9a2b1c0d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a\",\n  \"body\": \"{\\\"ok\\\":true}\",\n  \"signature\": \"MEUCIQDx...base64url\"\n}")
  .asString();
```

```php Security_verifyRequestSignature_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://tenant.api.corpx.com/v1/security/signature/verify', [
  'body' => '{
  "path": "/v1/accounts/acc-123/pix/payments",
  "method": "POST",
  "timestamp": "1789412400",
  "idempotencyKey": "9a5f8c2e-1b3d-4e6f-8a7b-0c1d2e3f4a5b",
  "contentSha256": "3f9a2b1c0d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a",
  "body": "{\\"ok\\":true}",
  "signature": "MEUCIQDx...base64url"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'X-Tenant-Id' => 'X-Tenant-Id',
  ],
]);

echo $response->getBody();
```

```csharp Security_verifyRequestSignature_example
using RestSharp;

var client = new RestClient("https://tenant.api.corpx.com/v1/security/signature/verify");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Tenant-Id", "X-Tenant-Id");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"path\": \"/v1/accounts/acc-123/pix/payments\",\n  \"method\": \"POST\",\n  \"timestamp\": \"1789412400\",\n  \"idempotencyKey\": \"9a5f8c2e-1b3d-4e6f-8a7b-0c1d2e3f4a5b\",\n  \"contentSha256\": \"3f9a2b1c0d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a\",\n  \"body\": \"{\\\"ok\\\":true}\",\n  \"signature\": \"MEUCIQDx...base64url\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Security_verifyRequestSignature_example
import Foundation

let headers = [
  "X-Tenant-Id": "X-Tenant-Id",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "path": "/v1/accounts/acc-123/pix/payments",
  "method": "POST",
  "timestamp": "1789412400",
  "idempotencyKey": "9a5f8c2e-1b3d-4e6f-8a7b-0c1d2e3f4a5b",
  "contentSha256": "3f9a2b1c0d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a",
  "body": "{\"ok\":true}",
  "signature": "MEUCIQDx...base64url"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://tenant.api.corpx.com/v1/security/signature/verify")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```