# List document types

`GET /v1/document-types` · [Sandbox · coming soon]

> Base URL: Sandbox `https://sandbox.zulu.com.co/v1`
>
> Not in production yet: it arrives with this same signature. Try it in the sandbox.

Returns the document types zulu recognizes for beneficiaries and payers, sorted by code, and which entity type uses each. Filter with `entityType`. `PAS` is accepted as an alias of `PASS` (passport) and is not listed on its own.

## Authentication

`Authorization: Bearer <access_token>` (401 when missing or expired) and `X-API-Key` (403 when missing or not matching).

## Request

### Query parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `entityType` | string | optional | Only those of this entity type. Values: `person` (Natural person (an individual).), `company` (Company (legal entity).). |

## Responses

### 200

Document types.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `[].code` | string | required | Document type code. |
| `[].name` | string | required | Official name (in Spanish). |
| `[].entityTypes` | array<string> | required | Entity types that use it. |

### 400

Invalid request: the body is not JSON, a field has another type or fails its validation.

### 401

The access token is missing, invalid or expired.

### 403

The `X-API-Key` is missing, invalid or does not match the token.

### 429

Too many requests: wait the seconds in `Retry-After`.

### 500

Internal error.

## Errors

| HTTP | error | cause | Description |
| --- | --- | --- | --- |
| 400 | `BadRequestApiError` | `error in struct validation` | One or more fields fail their validation. `values` carries one message per field, keyed by its JSON path, naming the Go validator that failed. |
| 401 | — | `Unauthorized` | The `Authorization: Bearer <access_token>` header is missing, or the token is invalid or expired. |
| 403 | — | `Forbidden` | The `X-API-Key` is missing, unknown, revoked or does not belong to the credentials of the token. |
| 429 | — | `Too Many Requests` | You exceeded the request limit of your credentials. Wait the seconds in `Retry-After`. |
| 500 | `InternalServerApiError` | `[code:1] unexpected error` | Internal error. On operations that move money, check the state before retrying so the operation is not duplicated. |

## Examples

### Documents of people

```bash
curl "https://sandbox.zulu.com.co/v1/document-types?entityType=person" \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY"
```

**Response 200**

```json
[
  {
    "code": "CC",
    "name": "Cédula de ciudadanía",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "CD",
    "name": "Carné diplomático",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "CE",
    "name": "Cédula de extranjería",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "PASS",
    "name": "Pasaporte",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "PEP",
    "name": "Permiso Especial de Permanencia",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "PPT",
    "name": "Permiso por Protección Temporal",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "RC",
    "name": "Registro civil",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "SC",
    "name": "Salvoconducto de permanencia",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "TI",
    "name": "Tarjeta de identidad",
    "entityTypes": [
      "person"
    ]
  }
]
```

### All

```bash
curl https://sandbox.zulu.com.co/v1/document-types \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY"
```

**Response 200**

```json
[
  {
    "code": "CC",
    "name": "Cédula de ciudadanía",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "CD",
    "name": "Carné diplomático",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "CE",
    "name": "Cédula de extranjería",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "NIT",
    "name": "Número de Identificación Tributaria (NIT)",
    "entityTypes": [
      "company"
    ]
  },
  {
    "code": "PASS",
    "name": "Pasaporte",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "PEP",
    "name": "Permiso Especial de Permanencia",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "PPT",
    "name": "Permiso por Protección Temporal",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "RC",
    "name": "Registro civil",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "SC",
    "name": "Salvoconducto de permanencia",
    "entityTypes": [
      "person"
    ]
  },
  {
    "code": "TI",
    "name": "Tarjeta de identidad",
    "entityTypes": [
      "person"
    ]
  }
]
```

### Unknown entity type

```bash
curl "https://sandbox.zulu.com.co/v1/document-types?entityType=robot" \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY"
```

**Response 400**

```json
{
  "error": "BadRequestApiError",
  "cause": "error in struct validation",
  "values": {
    "entityType": "failed validation on the \"oneof\" tag with value required \"person company\""
  }
}
```
