---
title: "Look up affiliation"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.getarbol.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Look up affiliation

Path: Sanitas API › Affiliations

`POST /v1/sanitas/affiliations/lookup`

Read one matching member contract from an active Account connection. Confirmed affiliation results are reused for seven days. When the provider lists no contract for the document in the company, the answer is outcome noContract with active null: an answer, not a failure and not inactive, so confirm the document number and the company with the person. PATIENT_UNRESOLVED means it listed several contracts and none was chosen. The session is kept alive through the day, and one renewal is admitted only on expiry. This does not authorize care.

- **Scope:** `sanitas:affiliations:read`
- **Credentials:** an API key, a client-credentials token or a person's access token
- **Effect:** read-only; safe to retry
- **Limits:** request body up to 8 KB, response up to 32 KB
- **CLI:** `arbol sanitas affiliations lookup` · **MCP tool:** `sanitas_affiliations_lookup`

## Authentication

Requires one of the following:

- `arbolHuman`, oauth2, scopes: `sanitas:affiliations:read`
- `arbolMachine`, oauth2, scopes: `sanitas:affiliations:read`
- `arbolApiKey`, http, header `Authorization`

## Request body

_Required._

- `documentType` (`sanitas.affiliations.lookup.documentType`; string, required)
  - one of `"AS"`, `"CC"`, `"CD"`, `"CE"`, `"CN"`, `"MS"`, `"NI"`, `"NU"`, `"PA"`, `"PD"`, `"PE"`, `"PT"`, `"RC"`, `"SC"`, `"TI"`
- `documentNumber` (`sanitas.affiliations.lookup.documentNumber`; string, required)
  - pattern `^[A-Za-z0-9]{1,25}$`
- `connectionId` (`sanitas.affiliations.lookup.connectionId`; string, optional)
  - pattern `^con_[0-9a-z]{26}$`
- `providerId` (`sanitas.affiliations.lookup.providerId`; string, optional) — An exact provider context id from getConnection(expand: providers), required when the source has no selected default.
  - pattern `^[1-9][0-9]{0,8}$`
- `company` (`sanitas.affiliations.lookup.company`; string, optional)
  - one of `"sanitas"`, `"colsanitas"`, `"medisanitas"`

## Example request

```json
{
  "connectionId": "string",
  "providerId": "string",
  "documentType": "AS",
  "documentNumber": "string",
  "company": "sanitas"
}
```

## Code samples

### cURL

```bash
curl https://api.getarbol.com/v1/sanitas/affiliations/lookup \
  --request POST \
  --header "Authorization: Bearer $ARBOL_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "documentType": "CC",
  "documentNumber": "<documentNumber>"
}'
```

### TypeScript

```typescript
import { createClient } from "@arbol-ai/sdk";

const arbol = createClient({
  baseUrl: "https://api.getarbol.com",
  token: process.env.ARBOL_API_KEY!,
});

const { data } = await arbol.sanitas.affiliations.lookup({
  documentType: "CC",
  documentNumber: "<documentNumber>",
});
```

### Rust

```rust
use arbol_sdk::{types, Client, Credential};

let arbol = Client::new(Credential::ApiKey(std::env::var("ARBOL_API_KEY")?))?;

let data = arbol
    .sanitas()
    .affiliations()
    .lookup(&types::SanitasAffiliationsLookupInput {
        document_type: types::SanitasAffiliationsLookupInputDocumentType::CC,
        document_number: "<documentNumber>".into(),
        connection_id: None,
        provider_id: None,
        company: None,
    })
    .await?;
```

### CLI

```bash
arbol sanitas affiliations lookup --document-type CC --document-number '<documentNumber>'
```

### MCP

```json
{
  "name": "sanitas_affiliations_lookup",
  "arguments": {
    "documentType": "CC",
    "documentNumber": "<documentNumber>"
  }
}
```

## Responses

### 200

Successful operation.

#### Example

```json
{
  "success": true,
  "data": {
    "documentType": "AS",
    "documentNumber": "string",
    "company": "sanitas",
    "checkedAt": "2019-08-24T14:15:22Z",
    "active": true,
    "status": "string",
    "plan": "string",
    "contractNumber": "string",
    "category": "string",
    "affiliateType": "string"
  },
  "error": null,
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.200.success`; boolean, required)
  - one of `true`
- `data` (`sanitas.affiliations.lookup.response.200.data`; SanitasLookupAffiliationResult, required)
  - any of: `SanitasSanitasAffiliation`, `SanitasSanitasNoContract`
- `error` (`sanitas.affiliations.lookup.response.200.error`; unknown, required)
- `metadata` (`sanitas.affiliations.lookup.response.200.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.200.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 400

`INVALID_INPUT`: The request does not match the published schema.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "INVALID_INPUT",
    "message": "string",
    "retryable": false,
    "data": {
      "issues": [
        {
          "path": "string",
          "message": "string"
        }
      ]
    }
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.400.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.400.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.400.error`; object, required) — The request does not match the published schema.
  - `code` (`sanitas.affiliations.lookup.response.400.error.code`; string, required) — The failure code, stable across releases.
    - one of `"INVALID_INPUT"`
  - `message` (`sanitas.affiliations.lookup.response.400.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`sanitas.affiliations.lookup.response.400.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`sanitas.affiliations.lookup.response.400.error.data`; object, required)
    - `issues` (`sanitas.affiliations.lookup.response.400.error.data.issues`; array<object>, optional)
      - `path` (`sanitas.affiliations.lookup.response.400.error.data.issues.path`; string, required) — RFC 6901 JSON Pointer to the refused field; empty for the whole input.
        - maxLength 256
      - `message` (`sanitas.affiliations.lookup.response.400.error.data.issues.message`; string, required)
        - maxLength 256
- `metadata` (`sanitas.affiliations.lookup.response.400.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.400.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 401

`UNAUTHORIZED`: A valid access token is required.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.401.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.401.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.401.error`; object, required) — A valid access token is required.
  - `code` (`sanitas.affiliations.lookup.response.401.error.code`; string, required) — The failure code, stable across releases.
    - one of `"UNAUTHORIZED"`
  - `message` (`sanitas.affiliations.lookup.response.401.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`sanitas.affiliations.lookup.response.401.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`sanitas.affiliations.lookup.response.401.error.data`; object, required) — No fields.
- `metadata` (`sanitas.affiliations.lookup.response.401.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.401.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 403

`FORBIDDEN`: The token does not authorize this operation.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "FORBIDDEN",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.403.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.403.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.403.error`; object, required) — The token does not authorize this operation.
  - `code` (`sanitas.affiliations.lookup.response.403.error.code`; string, required) — The failure code, stable across releases.
    - one of `"FORBIDDEN"`
  - `message` (`sanitas.affiliations.lookup.response.403.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`sanitas.affiliations.lookup.response.403.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`sanitas.affiliations.lookup.response.403.error.data`; object, required) — No fields.
- `metadata` (`sanitas.affiliations.lookup.response.403.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.403.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 404

`CONNECTION_NOT_FOUND`: The connection is unavailable in this organization.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "CONNECTION_NOT_FOUND",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.404.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.404.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.404.error`; object, required) — The connection is unavailable in this organization.
  - `code` (`sanitas.affiliations.lookup.response.404.error.code`; string, required) — The failure code, stable across releases.
    - one of `"CONNECTION_NOT_FOUND"`
  - `message` (`sanitas.affiliations.lookup.response.404.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`sanitas.affiliations.lookup.response.404.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`sanitas.affiliations.lookup.response.404.error.data`; object, required) — No fields.
- `metadata` (`sanitas.affiliations.lookup.response.404.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.404.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 409

- `CONNECTION_REQUIRED`: Select an active Sanitas connection.
- `PROVIDER_CONTEXT_REQUIRED`: Select one of this connection’s provider contexts before querying affiliation.
- `PROVIDER_SESSION_EXPIRED`: The provider session requires verification.
- `PATIENT_UNRESOLVED`: The provider listed several contracts for this document in this company and none was chosen. Coverage is unknown.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "CONNECTION_REQUIRED",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.409.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.409.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.409.error`; SanitasLookupAffiliationConflictFailure, required)
  - one of: `SanitasConnectionRequiredFailure`, `SanitasProviderContextRequiredFailure`, `SanitasProviderSessionExpiredFailure`, `SanitasPatientUnresolvedFailure`
  - discriminator: `code`
- `metadata` (`sanitas.affiliations.lookup.response.409.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.409.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 413

`REQUEST_TOO_LARGE`: The request exceeds the allowed size.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "REQUEST_TOO_LARGE",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.413.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.413.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.413.error`; object, required) — The request exceeds the allowed size.
  - `code` (`sanitas.affiliations.lookup.response.413.error.code`; string, required) — The failure code, stable across releases.
    - one of `"REQUEST_TOO_LARGE"`
  - `message` (`sanitas.affiliations.lookup.response.413.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`sanitas.affiliations.lookup.response.413.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`sanitas.affiliations.lookup.response.413.error.data`; object, required) — No fields.
- `metadata` (`sanitas.affiliations.lookup.response.413.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.413.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 415

`UNSUPPORTED_MEDIA_TYPE`: The request content type is not supported.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "UNSUPPORTED_MEDIA_TYPE",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.415.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.415.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.415.error`; object, required) — The request content type is not supported.
  - `code` (`sanitas.affiliations.lookup.response.415.error.code`; string, required) — The failure code, stable across releases.
    - one of `"UNSUPPORTED_MEDIA_TYPE"`
  - `message` (`sanitas.affiliations.lookup.response.415.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`sanitas.affiliations.lookup.response.415.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`sanitas.affiliations.lookup.response.415.error.data`; object, required) — No fields.
- `metadata` (`sanitas.affiliations.lookup.response.415.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.415.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 422

`CREDENTIALS_REJECTED`: The organization's connection to this integration couldn't complete the request. Don't retry it automatically; if it keeps happening, contact your Arbol team.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "CREDENTIALS_REJECTED",
    "message": "string",
    "retryable": false
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.422.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.422.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.422.error`; object, required) — The organization's connection to this integration couldn't complete the request. Don't retry it automatically; if it keeps happening, contact your Arbol team.
  - `code` (`sanitas.affiliations.lookup.response.422.error.code`; string, required) — The failure code, stable across releases.
    - one of `"CREDENTIALS_REJECTED"`
  - `message` (`sanitas.affiliations.lookup.response.422.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`sanitas.affiliations.lookup.response.422.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
- `metadata` (`sanitas.affiliations.lookup.response.422.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.422.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 429

- `RATE_LIMITED`: The request rate limit was exceeded. Try again later.
- `LOGIN_COOLING_DOWN`: The organization's connection to this integration couldn't complete the request. Don't retry it automatically; if it keeps happening, contact your Arbol team.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "RATE_LIMITED",
    "message": "string",
    "retryable": true,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.429.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.429.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.429.error`; SanitasLookupAffiliationTooManyRequestsFailure, required)
  - one of: `RateLimitedFailure`, `SanitasLoginCoolingDownFailure`
  - discriminator: `code`
- `metadata` (`sanitas.affiliations.lookup.response.429.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.429.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 500

`INTERNAL_ERROR`: The service could not complete the operation.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "INTERNAL_ERROR",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.500.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.500.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.500.error`; object, required) — The service could not complete the operation.
  - `code` (`sanitas.affiliations.lookup.response.500.error.code`; string, required) — The failure code, stable across releases.
    - one of `"INTERNAL_ERROR"`
  - `message` (`sanitas.affiliations.lookup.response.500.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`sanitas.affiliations.lookup.response.500.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `false`
  - `data` (`sanitas.affiliations.lookup.response.500.error.data`; object, required) — No fields.
- `metadata` (`sanitas.affiliations.lookup.response.500.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.500.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 502

- `OUTCOME_UNKNOWN`: The operation may have been applied; check its result before repeating it.
- `PROVIDER_PROTOCOL_CHANGED`: The provider response could not be verified.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "OUTCOME_UNKNOWN",
    "message": "string",
    "retryable": false,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.502.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.502.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.502.error`; SanitasLookupAffiliationBadGatewayFailure, required)
  - one of: `OutcomeUnknownFailure`, `SanitasProviderProtocolChangedFailure`
  - discriminator: `code`
- `metadata` (`sanitas.affiliations.lookup.response.502.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.502.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 503

- `UPSTREAM_UNAVAILABLE`: The upstream service could not complete the request.
- `PROVIDER_UNAVAILABLE`: The provider is temporarily unavailable. Coverage is unknown.
- `PROVIDER_ACCESS_DENIED`: Sanitas denied the validator request. Coverage is unknown.
- `PROVIDER_CHALLENGE_REQUIRED`: The provider requires an interactive challenge. Coverage is unknown.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "UPSTREAM_UNAVAILABLE",
    "message": "string",
    "retryable": true,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.503.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.503.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.503.error`; SanitasLookupAffiliationServiceUnavailableFailure, required)
  - one of: `UpstreamUnavailableFailure`, `SanitasProviderUnavailableFailure`, `SanitasProviderAccessDeniedFailure`, `SanitasProviderChallengeRequiredFailure`
  - discriminator: `code`
- `metadata` (`sanitas.affiliations.lookup.response.503.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.503.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.

### 504

`UPSTREAM_TIMEOUT`: The upstream service did not respond before its deadline.

#### Example

```json
{
  "success": false,
  "data": null,
  "error": {
    "code": "UPSTREAM_TIMEOUT",
    "message": "string",
    "retryable": true,
    "data": {}
  },
  "metadata": {
    "requestId": "string"
  }
}
```

- `success` (`sanitas.affiliations.lookup.response.504.success`; boolean, required)
  - one of `false`
- `data` (`sanitas.affiliations.lookup.response.504.data`; unknown, required)
- `error` (`sanitas.affiliations.lookup.response.504.error`; object, required) — The upstream service did not respond before its deadline.
  - `code` (`sanitas.affiliations.lookup.response.504.error.code`; string, required) — The failure code, stable across releases.
    - one of `"UPSTREAM_TIMEOUT"`
  - `message` (`sanitas.affiliations.lookup.response.504.error.message`; string, required) — What went wrong, for people; it never contains input values.
  - `retryable` (`sanitas.affiliations.lookup.response.504.error.retryable`; boolean, required) — Whether repeating the same request may succeed.
    - one of `true`
  - `data` (`sanitas.affiliations.lookup.response.504.error.data`; object, required) — No fields.
- `metadata` (`sanitas.affiliations.lookup.response.504.metadata`; object, required) — What every answer carries besides its data or error.
  - `requestId` (`sanitas.affiliations.lookup.response.504.metadata.requestId`; string, required) — Request correlation identifier, also sent as X-Request-Id.


Source: https://docs.getarbol.com/api/sanitas/affiliations/lookup/index.md
