---
title: "Add holder documents to an order"
description: "How to upload the holder's documents and add them to an existing Amplia Reg order through the API, in .NET or with direct REST calls."
canonical: "https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/add-holder-files"
locale: "en"
product: "Amplia Reg"
last_updated: "2026-11-17"
---

# Add holder documents to an order

After you [create an order](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/create-order), you can send the holder's documents through the API, such as the identity document or the
proof of address. Amplia Reg adds them to the order, and the agents see them when they validate it.

## Before you start

You will need:

* The order number. This is the `number` that the API returned when you [created](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/create-order#response) the order.
* An application with the **Sales app** role, created in a CA or in an RA. If the API returns the `SubscriptionRequired` error, the
  application does not belong to a CA or an RA.
* The code of the holder type. The holder type defines the documents that the order accepts. If the order already has a holder type,
  send the same one, because this API cannot change it. To list the holder types, call `GET /api/holder-types?isDisabled=false`. Each item
  has `id`, `name` and `code`.
* An order whose data can still be edited. Once the order is waiting issue, for example, the API responds with the `OrderCannotUpdate`
  error.

## Add the documents

**.NET**

```cs
var response = await ampliaRegService.AddHolderFilesAsync(
	"800-005-520", // Order number
	new List<HolderFileReference2>() {
		new HolderFileReference2() {
			Type = "Identification",
			Subtype = HolderFileSubtypes.Cnh,
			DocumentPart = DocumentParts.FrontComplete,
			File = FileReference.FromFile(@"C:\AppData\Documents\cnh.pdf"),
		},
	},
	HolderTypeReference.FromCode("PF") // Holder type code
);
```

The .NET client library uploads the files for you. See [Reference files](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/add-holder-files#file-referencing) for the ways to reference a file.

**REST**

First, [upload each file](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/add-holder-files#file-referencing). Then add the uploads to the order:

```js
POST /api/orders/800-005-520/holder-files
{
	"holderType": {
		"code": "PF" // Holder type code
	},
	"holderFiles": [
		{
			"type": "Identification",
			"subtype": "Cnh",
			"documentPart": "FrontComplete",
			"file": {
				"id": "0195a9dc-c0f0-4f5c-83d3-bf562ae98ed9", // ID returned by the upload
				"name": "cnh.pdf",
				"contentType": "application/pdf"
			}
		}
	]
}
```

**curl**

First, [upload each file](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/add-holder-files#file-referencing). Then add the uploads to the order:

```bash
curl -X POST "https://ampliareg.yourcompany.com/api/orders/800-005-520/holder-files" \
  -H "X-Api-Key: your-app|YOUR_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @body.json
```

Content of `body.json`:

```json
{
  "holderType": {
    "code": "PF"
  },
  "holderFiles": [
    {
      "type": "Identification",
      "subtype": "Cnh",
      "documentPart": "FrontComplete",
      "file": {
        "id": "0195a9dc-c0f0-4f5c-83d3-bf562ae98ed9",
        "name": "cnh.pdf",
        "contentType": "application/pdf"
      }
    }
  ]
}
```

See [Fields of each document](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/add-holder-files#holder-file-fields) for the values of `type`, `subtype` and `documentPart`.

You can use each upload only once, because Amplia Reg moves the file into the order and deletes the upload.

## Fields of each document

The holder type of the order defines which documents are required and which are optional. Each item of `holderFiles` has:

* `type`: the document type, such as `Identification`, `AddressProof` or `Photo`. Custom document types configured on the instance are
  prefixed with `@` (for example, `@CustomDoc1`). See [Add document types](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/on-premises/add-doc-types).
* `subtype` and `documentPart` (optional): in ICP-Brasil, an `Identification` document can state which document it is (`Rg`, `Cnh`, `Dni`,
  `CTPS`, `Passport`, `RNE`, `CIN`, `OAB`, `CRC`, `CRM`, `ProfessionalLicense` or `Undefined`). When `subtype` is given, `documentPart` is
  required: `FrontComplete` or `BackComplete`, and also `Digital` for every subtype except `Rg`, `RNE` and `Undefined`.
* `file`: the file reference. See [Reference files](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/add-holder-files#file-referencing).

## Response

```js
{
	"holderFileIds": [
		"7c1e4b9a-2f3d-4e8a-9b6c-1d2e3f4a5b6c"
	]
}
```

`holderFileIds` has the ID of each document added, in the same order as `holderFiles` in the request.

## Common errors

| Error code | When it happens |
|---|---|
| `OrderCannotUpdate` | The order's data can no longer be changed because of its status |
| `CannotChangeHolderType` | The order already has a different holder type |
| `HolderTypeNotAllowed` | The order's certificate type does not accept the holder type |
| `HolderFileTypeCannotBeAdded` | The holder type does not accept one of the document types sent |
| `UnexpectedHolderFileSubtype` | The document type does not accept subtypes, or does not accept the given subtype |

See [Error codes](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/error-codes) for the full list.

Example of an error response, with HTTP 422:

```json
{
  "code": "OrderCannotUpdate",
  "message": "..."
}
```

## Reference files

The options below apply to every API that receives files, such as this one and the [pre-approved orders](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/preapproved-orders) API.

In .NET, you can reference a file:

* By its *path*: `FileReference.FromFile(@"C:\AppData\Documents\document.pdf")`
* By a `FileInfo` object: `FileReference.FromFile(new FileInfo(@"C:\AppData\Documents\document.pdf"))`
* By its content, as a byte array. In this case, also give the file name: `FileReference.FromBytes(bytes, "document.pdf")`
* By a `stream`. You also need to give the file name: `FileReference.FromStream(stream, "document.pdf")`

The library uploads the file for you.

Through the API, the file never goes inside the JSON body. First upload it with a `multipart/form-data` request with the `file`, `name`
and `contentType` fields:

```bash
curl -X POST "https://ampliareg.yourcompany.com/api/uploads" \
  -H "X-Api-Key: your-app|YOUR_KEY" \
  -F "file=@document.pdf" \
  -F "name=document.pdf" \
  -F "contentType=application/pdf"
```

The response has the upload `id`. Then reference the upload in the API that receives the file:

```js
"file": {
	"id": "0195a9dc-c0f0-4f5c-83d3-bf562ae98ed9", // ID returned by the upload
	"name": "document.pdf",
	"contentType": "application/pdf"
}
```

## See also

* [Create an order](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/create-order)
* [Pre-approved orders](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/preapproved-orders)
* [Error codes](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/error-codes)
