Skip to main content

Test Your First Request

Use this guide to verify that your Custodian Labs API key works.

This page shows a simple text transformation request. For your first test, use fictional information only.

Test from the terminal

Use curl to send a request directly from your terminal.

Store your API key

Set your API key as an environment variable in your terminal:

export CUSTODIAN_API_KEY="your_api_key_here"

Send a text transformation request

Send a POST request to Guardian Layer:

curl -i -X POST "<MASKING_API_BASE_URL>/api/v1/deidentify/text/proprietary/outputs" \
-H "X-API-Key: $CUSTODIAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Please contact Jane Smith at jane.smith@example.com or call (415) 555-0123.",
"domain": "General",
"masking_type": "transform",
"pii_entities": ["ALL"]
}'

Replace <MASKING_API_BASE_URL> with the Custodian Labs API base URL for your environment.

Expected response

A successful request returns 200 OK and two transformed alternatives:

{
"original_text": "Please contact Jane Smith at jane.smith@example.com or call (415) 555-0123.",
"outputs": [
{
"id": 1,
"text": "Please contact Maria Lopez at maria.lopez@example.com or call (415) 555-0187."
},
{
"id": 2,
"text": "Please contact David Kim at david.kim@example.com or call (415) 555-0194."
}
],
"mode": "PROPRIETARY_OUTPUTS",
"meta": {}
}

The exact transformed values may vary.

Try redaction

To remove detected information instead of replacing it, change:

"masking_type": "redact"

Test from the Dashboard

You can also verify your API key without using the terminal:

  1. Open API Testing in the Dashboard.
  2. Select your API key.
  3. Choose Enter Text.
  4. Paste a short example containing fictional information.
  5. Select All PII.
  6. Choose Transform or Redact.
  7. Click Mask Now.

The transformed output appears in the Results panel.

Common first-request issues

Status or symptomLikely causeWhat to check
401 UnauthorizedThe API key is missing or invalidConfirm that the header is X-API-Key and copy the key again from the Dashboard
403 ForbiddenThe API key has expiredCheck the renewal date on the API Keys page
429 Too Many RequestsYour token or request allowance has been reachedCheck your usage in the Dashboard and review your plan
422 Unprocessable EntityThe request body contains an invalid field or valueCompare your JSON body with the example above
Request times outThe API service or endpoint is unavailableConfirm the base URL and contact support if the issue continues

Next steps