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:

FieldTypeDescription
promptstringThe text you want to redact. This can be any string containing sensitive information.
mask_typestringThe type of masking to apply. Options include: char (character masking), label(entity masking), enhanced (enhanced entity masking).
mask_charstringThe character to replace sensitive data with (only used if mask_type is char).
entitiesarrayAn 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

FieldTypeDescription
statusstringThe status of the request. Possible values: success, error.
redacted_textstringThe redacted text with sensitive information masked.
redacted_entitiesarrayAn array of entities that were redacted (empty if no entities were detected).
metadataobjectContains metadata about the redaction process.
creditsobjectInformation about the user's credits (remaining and used).
request_idstringA unique identifier for the request.

Metadata Fields

FieldTypeDescription
mask_charstringThe character used for masking.
mask_typestringThe type of masking applied (e.g., char).
detected_entitiesintegerThe number of entities detected in the prompt.
redacted_entitiesintegerThe number of entities redacted.
confidencefloatThe confidence level of the redaction process (0.0 to 100.0).
processing_timefloatThe time taken to process the redaction, in seconds.

Credits Fields

FieldTypeDescription
remaining_creditsfloatThe remaining credits available for use.
redacted_costfloatThe 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

CodeDescription
400Bad Request. This occurs if the required fields are missing or the data format is invalid.
453Unauthorized. Invalid or missing API key.
500Internal Server Error. The server encountered an unexpected condition.
429Too 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: The mask_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