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

# Download eBRC PDF

> Download a generated eBRC certificate as a PDF by certificate number, returning the raw file with a Content-Disposition attachment header for saving locally.

Download a generated eBRC certificate as a PDF. The certificate is fetched from
the DGFT portal using the customer's stored DGFT credentials and cached, so the
first call for a certificate may take longer than subsequent (cached) calls.

<Info>
  Rate limited to **5 downloads per minute**. Cached results return quickly and
  still count toward the limit.
</Info>

### Request

```bash theme={"dark"}
curl -X GET \
  "https://ebrcapi.eximfiles.io/api/v1/genebrc/download-pdf/{eBRCNumber}?platformCustomerId={id}" \
  -H "x-api-key: <YOUR_API_KEY>" \
  --output ebrc.pdf
```

A successful response is the raw `application/pdf` body with
`Content-Disposition: attachment`.

### Handling credential failures

Downloads use the customer's DGFT connection. If the customer
**changed or reset their DGFT password**, that connection fails and the download
returns a **structured error** you can act on programmatically. Branch on
`errorCode`, never on the human-readable `message`.

```json theme={"dark"}
{
  "statusCode": 409,
  "errorCode": "DGFT_CREDENTIALS_INVALID",
  "requiresPasswordUpdate": true,
  "message": "We could not sign in to the DGFT portal with your saved password. Please update it to download this certificate.",
  "causes": [
    "Your DGFT portal password was recently changed",
    "The password on file has expired",
    "The account was locked after multiple failed attempts"
  ],
  "path": "/api/v1/genebrc/download-pdf/...",
  "timestamp": "2026-07-19T06:31:04.874Z"
}
```

| `errorCode`                | HTTP | `requiresPasswordUpdate` | What it means                           | What to do                                                        |
| -------------------------- | ---- | ------------------------ | --------------------------------------- | ----------------------------------------------------------------- |
| `DGFT_CREDENTIALS_INVALID` | 409  | `true`                   | Stored DGFT password was rejected       | Update the customer's DGFT password (below), then retry           |
| `DGFT_ACCOUNT_LOCKED`      | 409  | `true`                   | DGFT locked the portal account          | Reset the password on the DGFT portal, update it here, then retry |
| `DGFT_CREDENTIALS_MISSING` | 422  | `true`                   | No DGFT credentials on file             | Link the customer's DGFT account first                            |
| `EBRC_NOT_FOUND`           | 404  | `false`                  | Certificate not on the portal yet       | Retry later                                                       |
| `DGFT_PORTAL_UNAVAILABLE`  | 502  | `false`                  | DGFT portal was unreachable/misbehaving | Retry after a short delay                                         |

### Recovering from `requiresPasswordUpdate`

When `requiresPasswordUpdate` is `true`, submit the customer's **current** DGFT
credentials (same username, new password) to update the stored password, then
retry the download:

```bash theme={"dark"}
curl -X POST \
  "https://ebrcapi.eximfiles.io/api/v1/platform-customers/{id}/check-dgft-credentials" \
  -H "x-api-key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{ "dgftUsername": "<DGFT_USERNAME>", "dgftPassword": "<DGFT_PORTAL_PASSWORD>" }'
```

On success (`201`) the stored credentials are replaced in place. Retry the
download and it will use the updated password.

<Note>
  Re-submitting the **same** DGFT username with a new password is an update.
  Submitting a **different** username is rejected, since that would be switching to a
  different DGFT account, not a password update.
</Note>

### Next steps

* [Fetch eBRC details](/api-reference/genebrc/fetch-details) to find `eBRCNumber` values.
* [Validate Customer](/api-reference/customer/validate) to update stored DGFT credentials.
* [Errors](/errors) for the full error body and status code reference.
