API Specification
Directly interact with the Spro API to mask sensitive information in your AI applications.
The Redaction API allows you to mask sensitive information from text by providing different types of masking methods. This API is designed to help users protect Personally Identifiable Information (PII) and other sensitive data in their AI applications.
API Endpoint
POST https://beta.hridaai.com/v1/redact
Request Headers
Authorization
: Bearer Token (API key for authenticating requests)Content-Type
:application/json
Request Body
The body of the request must be a JSON object containing the following fields:
Field | Type | Description |
---|---|---|
prompt | string | The text you want to redact. This can be any string containing sensitive information. |
mask_type | string | The type of masking to apply. Options include: char (character masking), label (entity masking), enhanced (enhanced entity masking). |
mask_char | string | The character to replace sensitive data with (only used if mask_type is char ). |
entities | array | An optional array of specific entities to redact. This is an empty array by default. |
Example Request
curl -X POST "https://beta.hridaai.com/v1/redact" \
-H "Authorization: Bearer ${SPRO_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"prompt": "some text",
"mask_type": "char",
"mask_char": "*",
"entities": []
}'
Response
The API will respond with a JSON object containing the redacted text and additional metadata about the redaction process.
Response Fields
Field | Type | Description |
---|---|---|
status | string | The status of the request. Possible values: success , error . |
redacted_text | string | The redacted text with sensitive information masked. |
redacted_entities | array | An array of entities that were redacted (empty if no entities were detected). |
metadata | object | Contains metadata about the redaction process. |
credits | object | Information about the user's credits (remaining and used). |
request_id | string | A unique identifier for the request. |
Metadata Fields
Field | Type | Description |
---|---|---|
mask_char | string | The character used for masking. |
mask_type | string | The type of masking applied (e.g., char ). |
detected_entities | integer | The number of entities detected in the prompt . |
redacted_entities | integer | The number of entities redacted. |
confidence | float | The confidence level of the redaction process (0.0 to 100.0). |
processing_time | float | The time taken to process the redaction, in seconds. |
Credits Fields
Field | Type | Description |
---|---|---|
remaining_credits | float | The remaining credits available for use. |
redacted_cost | float | The cost of the current redaction process. |
Example Response
{
"status": "success",
"redacted_text": "some text",
"redacted_entities": [],
"metadata": {
"mask_char": "*",
"mask_type": "char",
"detected_entities": 0,
"redacted_entities": 0,
"confidence": 0.0,
"processing_time": 0.004246
},
"credits": {
"remaining_credits": 24.95919,
"redacted_cost": 1e-05
},
"request_id": "643db0c3-beea-4944-b4ff-7f6013526b9e"
}
Error Codes
Code | Description |
---|---|
400 | Bad Request. This occurs if the required fields are missing or the data format is invalid. |
453 | Unauthorized. Invalid or missing API key. |
500 | Internal Server Error. The server encountered an unexpected condition. |
429 | Too Many Requests. You have exceeded your rate limit. |
Rate Limits
The Redaction API has rate limits in place to prevent abuse and ensure fair usage. The rate limits are as follows:
- Free Tier: 1000 requests per day
- Pro Tier: Unlimited requests per day
- Enterprise Tier: Custom rate limits based on your subscription
If you exceed the rate limits for your tier, you will receive a 429 Too Many Requests
response with a message indicating that you have exceeded your rate limit. You can upgrade your subscription to increase your rate limits.
Authentication
To authenticate requests, include a valid Bearer token in the Authorization
header. You can obtain an API key by signing up for an account on the Spro platform.
Pro Tips
- Use the
mask_char
Field: If you are using character masking, you can specify the character to use for masking sensitive data. This allows you to customize the redaction process to suit your needs. - Use entities Field: If you want to redact specific entities from the text, you can provide an array of entities to redact. This gives you more control over the redaction process and ensures that only the specified entities are masked.
- Leverage the
mask_type
Field: Themask_type
field allows you to choose the type of masking to apply to the text. You can choose between character masking, entity masking, and enhanced entity masking to suit your specific use case. - Monitor Your Credits: Keep an eye on your remaining credits to ensure that you do not exceed your daily limit. If you are running low on credits, you can upgrade your subscription to increase your rate limits.
Support
If you have any questions or need assistance with the Redaction API, please contact our support team at hrida.aiofficial@gmail.com