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

# Turn a pay link on or off

> PUT /v1/invoices/{invoiceId}/payment-link turns an invoice's hosted pay link on or off.

```
PUT /v1/invoices/{invoiceId}/payment-link
```

**Scope:** `invoices:write`  ·  **Idempotency-Key:** optional

<ParamField path="invoiceId" type="string" required>The invoice.</ParamField>
<ParamField body="enabled" type="boolean" required>`true` to turn the link on, `false` to turn it off.</ParamField>

```bash theme={null}
curl -X PUT https://api.stg.cleo-pay.com/v1/invoices/d7e8f9a0-b1c2-4d3e-8f4a-5b6c7d8e9f0a/payment-link \
  --header "Authorization: Bearer $CLEO_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{ "enabled": false }'
```

## Response

`200` with the [invoice](/api-reference/invoices/get). `paymentLink.enabled` is `true` only while the customer can pay through it.

## Errors

| Code | When |
| - | - |
| `validation_error` | Turning on the link of a draft (send it first), of an invoice the customer has not approved yet, or of a paid, void, declined or blocked invoice. |
| `payments_locked`, `setup_incomplete`, `setup_required`, `feature_unavailable` | Turning it on while the business cannot receive. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.