# Z-Mask personal data masking API

Integrate text masking and page balance checks using a Z-Mask API key. Get started with server-side REST requests and keep credentials out of browser code.

Source: https://z-mask.com/masking-api/

## Create an account-scoped API key

Sign in to the workspace and open API & service to create a Z-Mask API key. Store it in your server's secret manager or environment, and send it as a Bearer token. Revoke keys that are no longer needed.

Do not include API keys in browser bundles, URLs, public repositories or logs. Calls run with the key owner's account permissions and applicable usage limits. The examples below use fictional input and an environment variable, not a real credential.

## Mask text from your server

Send JSON containing a text field to POST /v1/mask. Inspect the returned result and review the detected entities before forwarding text to another system. Use synthetic test data when setting up the integration.

```sh
curl "https://api.zmask.zcntech.com/functions/v1/masking-gateway/v1/mask" \
  -H "Authorization: Bearer $ZMASK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Contact Emma Walker at emma.walker@example.com."}'
```

## Check the page balance

Call GET /v1/balance with the same key to inspect the account's page allowance before submitting a document workflow. A balance check does not reserve credits; concurrent requests may change the available balance.

```sh
curl "https://api.zmask.zcntech.com/functions/v1/masking-gateway/v1/balance" \
  -H "Authorization: Bearer $ZMASK_API_KEY"
```

## Handle failures without exposing data

Check HTTP status codes before using a response. Handle expired or revoked credentials, insufficient credits and processing failures in your application. Do not blindly retry billable document submissions after a timeout.

Keep request bodies and original documents out of analytics and error logs. Review the account's Processing history when diagnosing a document job. For enterprise network or retention requirements, discuss an on-premises installation with our team.

[Manage API keys](https://z-mask.com/en/app/?auth=login)
