> 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.

# Find the tenant's accounts by document

GET https://tenant.api.corpx.com/v1/tenant/accounts/search

Returns every account of the tenant in `X-Tenant-Id` whose holder
document matches `document`. One CPF or CNPJ can have more than one
account, so the result is a list, not a single account. Masks are
accepted (`123.456.789-00`); matching uses the digits only.

An empty `items` array is a successful response. This route does not
answer 404 for an unknown document.

Not paginated: a document has a handful of accounts. Requires the
`read` scope, and a credential restricted to specific accounts only
sees those. Does not include balances.


Reference: https://docs.api.corpx.com/baas/referencia/accounts/search-tenant-accounts-by-document

## Authentication

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

## Request

### Query parameters

- `document` (string, required) — Holder CPF (11 digits) or CNPJ (14 digits). Punctuation is ignored.

### Headers

- `X-Tenant-Id` (string, required) — Tenant context used for authorization and routing.

## Response

### 200

The accounts of that document in this tenant. `items` is empty when there are none.

- `tenantId` (string, required) — Tenant from `X-Tenant-Id`.
- `document` (string, required) — Digits of the document that was searched, without punctuation.
- `items` (list of TenantAccount, required) — Matching accounts. Empty when the document has no account in this tenant; that is not an error.

## Errors

### 400 Bad Request Error

`X-Tenant-Id` missing.

- `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.

### 401 Unauthorized Error

Authentication failed or token missing.

- `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.

### 403 Forbidden Error

The credential lacks the `read` scope, or the token is not bound to this tenant.

- `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.

### 422 Unprocessable Entity Error

`document` is missing or is not 11 (CPF) or 14 (CNPJ) digits.

- `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

### TenantAccount

An account of the tenant. Status is the local record, not a live read of the settlement bank, and there is no balance.

- `accountId` (string, required) — Account id to use on `/v1/accounts/{accountId}/...`.
- `tenantId` (string, required) — Tenant that owns the account.
- `partnerAccountId` (string, required) — Account id at the settlement bank.
- `document` (string, required) — Holder CPF or CNPJ, digits only.
- `holderName` (string, required) — Holder name.
- `status` (enum, required) — Account status.
  - Allowed values: `active`, `blocked`, `suspended`, `closed`, `pending`, `integrating`, `failed`
- `statusSource` (string, required, nullable) — Who last changed the status, when recorded. `null` when there is no source.
- `accountNumber` (string, required, nullable) — Local account number override. `null` when it was not set; the bank account route resolves the number live.
- `createdAt` (datetime, required) — When the account was recorded.
- `updatedAt` (datetime, required) — When the account record was last updated.

### 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

**Response**

```json
{
  "tenantId": "tn_7f3a9c",
  "document": "39053344705",
  "items": [
    {
      "accountId": "acc_01HZX",
      "tenantId": "tn_7f3a9c",
      "partnerAccountId": "123456",
      "document": "39053344705",
      "holderName": "Ana Souza",
      "status": "active",
      "statusSource": null,
      "accountNumber": "12345-6",
      "createdAt": "2026-10-01T15:04:05Z",
      "updatedAt": "2026-10-06T12:00:00Z"
    },
    {
      "accountId": "acc_01HZY",
      "tenantId": "tn_7f3a9c",
      "partnerAccountId": "654321",
      "document": "39053344705",
      "holderName": "Ana Souza",
      "status": "closed",
      "statusSource": null,
      "accountNumber": null,
      "createdAt": "2026-08-01T15:04:05Z",
      "updatedAt": "2026-09-01T15:04:05Z"
    }
  ]
}
```

**SDK Code**

```python Accounts_searchTenantAccountsByDocument_example
import requests

url = "https://tenant.api.corpx.com/v1/tenant/accounts/search"

querystring = {"document":"390.533.447-05"}

headers = {
    "X-Tenant-Id": "X-Tenant-Id",
    "Authorization": "Bearer <token>"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Accounts_searchTenantAccountsByDocument_example
const url = 'https://tenant.api.corpx.com/v1/tenant/accounts/search?document=390.533.447-05';
const options = {
  method: 'GET',
  headers: {'X-Tenant-Id': 'X-Tenant-Id', Authorization: 'Bearer <token>'}
};

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

```go Accounts_searchTenantAccountsByDocument_example
package main

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

func main() {

	url := "https://tenant.api.corpx.com/v1/tenant/accounts/search?document=390.533.447-05"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-Tenant-Id", "X-Tenant-Id")
	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

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

url = URI("https://tenant.api.corpx.com/v1/tenant/accounts/search?document=390.533.447-05")

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

request = Net::HTTP::Get.new(url)
request["X-Tenant-Id"] = 'X-Tenant-Id'
request["Authorization"] = 'Bearer <token>'

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

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

HttpResponse<String> response = Unirest.get("https://tenant.api.corpx.com/v1/tenant/accounts/search?document=390.533.447-05")
  .header("X-Tenant-Id", "X-Tenant-Id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://tenant.api.corpx.com/v1/tenant/accounts/search?document=390.533.447-05', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'X-Tenant-Id' => 'X-Tenant-Id',
  ],
]);

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

```csharp Accounts_searchTenantAccountsByDocument_example
using RestSharp;

var client = new RestClient("https://tenant.api.corpx.com/v1/tenant/accounts/search?document=390.533.447-05");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Tenant-Id", "X-Tenant-Id");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Accounts_searchTenantAccountsByDocument_example
import Foundation

let headers = [
  "X-Tenant-Id": "X-Tenant-Id",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://tenant.api.corpx.com/v1/tenant/accounts/search?document=390.533.447-05")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```