Skip to content

Commit 191ee0c

Browse files
author
Divya Bhushan
authored
Merge pull request #957 from PaloAltoNetworks/pythonsdk
Update pythonsdk and Error Codes
2 parents aa74b8f + 263bfb7 commit 191ee0c

7 files changed

Lines changed: 92 additions & 51 deletions

File tree

products/prisma-airs/api/airuntimesecurity/airuntimesecurityapi.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ These APIs protect your AI models, AI applications, AI datasets, and AI agents b
1818
The APIs efficiently scan for various threats, including prompt injections, insecure outputs, AI agentic threats, and sensitive data loss.
1919
To use these APIs, send prompts or model responses from your application and receive a threat assessment with recommended actions based on your AI security profile.
2020

21-
For licensing, onboarding, activation, and to obtain the API authentication key and profile name, refer to the [Prisma AIRS API](https://docs.paloaltonetworks.com/ai-runtime-security/activation-and-onboarding/ai-runtime-security-api-intercept-overview) administration documentation.
21+
For licensing, onboarding, activation, and to obtain the API authentication key and profile name, refer to the [Prisma AIRS AI Runtime API intecept](https://docs.paloaltonetworks.com/ai-runtime-security/activation-and-onboarding/ai-runtime-security-api-intercept-overview) administration documentation.
2222

2323
## Scan API Endpoints
2424

@@ -60,3 +60,8 @@ For complete details, refer to adminstration guide for the section on how to "ma
6060
- One API key per deployment profile - Each deployment profile in the [Customer Support Portal](https://support.paloaltonetworks.com/Support/Index) allows a single API key.
6161
- 2 MB maximum payload size per synchronous scan request - Limited to a maximum of 100 URLs per request.
6262
- 5 MB maximum payload size per asynchronous scan request - Limited to a maximum of 100 URLs per request.
63+
- The following size limitations apply:
64+
65+
- context: 100k characters limit on the contextual grounding context
66+
- prompt: 10k characters
67+
- response: 20k characters
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
id: errorcodes
3+
title: "Error Codes"
4+
sidebar_label: "Error Codes"
5+
keywords:
6+
- Prisma AIRS API
7+
- Reference
8+
- Cloud
9+
- API
10+
---
11+
12+
This page specifies the error codes for the Prisma AIRS AI Network: API intercept scan APIs.
13+
An error response in the API appears in the following format:
14+
15+
```json
16+
{
17+
"error": {
18+
"message": "Successfully scanned request"
19+
}
20+
}
21+
```
22+
23+
| HTTP Status Code | Description | Common Scenario |
24+
|---|---|---|
25+
| **200** | Successfully scanned request | The request was completed successfully, and the scan results were returned |
26+
| **400** | Bad Request - Request data is invalid or malformed | - Empty request body<br>- Unreadable request body<br>- Wrong request format<br>- No scan content provided in the scan request<br>- Both prompt and response are null<br>- Empty prompt: Scan request content's prompt is empty<br>- Empty response: Scan request content's response is empty<br>- No scan IDs provided<br>- Too many scan IDs: maximum 5 scan IDs allowed<br>- Scan ID length exceeds maximum allowed characters (36 characters allowed)<br>- Invalid scan ID format<br>- Invalid scan ID<br>- No report IDs provided<br>- Too many report IDs: maximum 5 report IDs allowed<br>- Report ID length exceeds maximum length (37 characters allowed)<br>- Profile ID invalid: Missing or bad profile ID format, must follow UUID format (for example, 12345678-0000-1234-1234-123456789012)<br>- Profile name invalid: Missing profile name or length exceeds the 100 characters limit |
27+
| **401** | Unauthenticated - Not Authenticated | - Missing API key or Oauth token |
28+
| **403** | Forbidden - Invalid API Key | - Invalid, revoked, or expired API key |
29+
| **404** | Not Found - Resource is not found | - Invalid API endpoint |
30+
| **405** | Method Not Allowed | - Using the wrong HTTP method (Refer to the Scan endpoints [reference docs](https://pan.dev/prisma-airs/api/airuntimesecurity/prisma-airs-ai-runtime-api-intercept/) for the relevant methods for each endpoint)<br>- Endpoint doesn't support the requested method |
31+
| **413** | Request Too Large - The request body is too large | - Scan content exceeds [size limits](https://pan.dev/prisma-airs/scan/api/) |
32+
| **415** | Unsupported Media Type | - Missing Content-Type header<br>- Content-Type is not application/json |
33+
| **429** | Too Many Requests - Request exceeds the limit | - API rate limit exceeded (Refer to the [limitations](https://pan.dev/prisma-airs/scan/api/) page for details)<br>- Too many concurrent scans<br>Limitations<br>* Synchrounous & asynchronous scans are limited based on API call quota<br>* Scan results and reports are not subject to an API call quota, but are subject to a 10 requests limit per minute|
34+
| **500** | Internal Server Error | - Unexpected server error |

products/prisma-airs/api/airuntimesecurity/pythonsdk.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ keywords:
1010
- API
1111
---
1212

13-
Prisma AIRS API Python SDK simplifies the integration of advanced AI security scanning capabilities into Python applications.
13+
Prisma AIRS AI Runtime API Python SDK simplifies the integration of advanced AI security scanning capabilities into Python applications.
1414

15-
It supports Python version 3.9 through 3.13, it offers synchronous and asynchronous scanning, robust error handling, and configurable retry strategies.
15+
It supports Python version `3.9` through `3.13`, it offers synchronous and asynchronous scanning, robust error handling, and configurable retry strategies.
1616

1717
To get started:
1818

1919
* Get the the [API key token and API security profile name](https://docs.paloaltonetworks.com/ai-runtime-security/administration/prevent-network-security-threats/api-intercept-create-configure-security-profile) (or API security profile ID).
2020

21-
* Install `aisecurity` package using pip, set environment variables, and initialize the Python SDK. (Refer to the Python SDK [installation guide](https://docs.paloaltonetworks.com/ai-runtime-security/activation-and-onboarding/ai-runtime-security-api-intercept-overview/airs-apis-python-sdk) for detailed steps.)
21+
* Install `pan-aisecurity` package using pip, set environment variables, and initialize the Python SDK. (Refer to the Python SDK [installation guide](https://docs.paloaltonetworks.com/ai-runtime-security/activation-and-onboarding/ai-runtime-security-api-intercept-overview/airs-apis-python-sdk) for detailed steps.)
2222

2323
* Create a Scanner instance referring to the Python SDK usage examples.
2424
A scanner instance performs security scans on your AI-generated content.
@@ -35,9 +35,9 @@ Each usage can use two functions:
3535

3636
## Error Handling & Exceptions
3737

38-
When the client is unable to fetch the expected response from the API server, a subclass of aisecurity.exceptions.AISecSDKException is raised.
38+
When the client is unable to fetch the expected response from the API server, a subclass of `aisecurity.exceptions.AISecSDKException` is raised.
3939

40-
There are five types of Exceptions defined in aisecurity/exceptions.py:
40+
There are five types of Exceptions defined in `aisecurity/exceptions.py`:
4141

4242
* AISEC_SERVER_SIDE_ERROR: Errors returned by the API server. For example, an invalid API key.
4343
* AISEC_CLIENT_SIDE_ERROR: Errors that occur on the client side. For example, a network connection issue.

products/prisma-airs/api/airuntimesecurity/pythonsdkasynciousage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ keywords:
1010
- API
1111
---
1212

13-
This page covers the key use cases of the AI Runtime Security Python SDK asyncio scan types with synchronous and asynchronous methods.
13+
This page covers the key use cases of the Prisma AIRS AI Runtime API Python SDK asyncio scan types with synchronous and asynchronous methods.
1414
It scans AI applications and agents, AI models, and AI data to detect and mitigate threats such as prompt injection, URL filtering, and sensitive data.
1515
Enable the relevant threat detection services in the ​​[API Security Profile](https://docs.paloaltonetworks.com/prisma-airs/administration/prevent-network-security-threats/api-intercept-create-configure-security-profile).
1616

products/prisma-airs/api/airuntimesecurity/pythonsdkusage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ keywords:
1010
- API
1111
---
1212

13-
This page covers the key use cases of the AI Runtime Security Python SDK inline scan types with synchronous and asynchronous methods.
13+
This page covers the key use cases of the Prisma AIRS AI Runtime API Python SDK inline scan types with synchronous and asynchronous methods.
1414
It scans AI applications and agents, AI models, and AI data to detect and mitigate threats such as prompt injection, URL filtering, and sensitive data.
1515
Enable the relevant threat detection services in the ​​[API Security Profile](https://docs.paloaltonetworks.com/prisma-airs/administration/prevent-network-security-threats/api-intercept-create-configure-security-profile).
1616

0 commit comments

Comments
 (0)