> ## Documentation Index
> Fetch the complete documentation index at: https://naviml.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

You can interact with the API through HTTP requests from any language.

## Authentication

All API requests should include your API key in an Authorization HTTP header as follows:

```
Authorization: Bearer API_KEY
```

You can obtain your API key from the [settings](https://app.naviml.com/settings/apikey).

Keep your API key confidential! Avoid sharing it with others or exposing it in client-side code (such as browsers or apps). For production requests, ensure they are routed through your backend server, where the API key can be securely accessed from an environment variable or key management service.

## Making a request

You can paste the command below into your terminal to run your first API request.
Make sure to replace API\_KEY with your secret API key, TEAM\_ID with your team ID, and VERIFIER\_ID with the verifier ID.

```bash theme={null}
curl --request POST \
  --url https://api.naviml.com/v1/TEAM_ID/verify \
  --header 'Authorization: Bearer API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "content": "Hello World",
      "role": "user"
    }
  ],
  "verifiers": [
    {
      "id": "VERIFIER_ID",
      "parameters": {
        "threshold": 0.5
      },
      "type": "policy-verifier"
    }
  ],
  "explain": true
}'
```

You should get a response that is similar to this:

```json theme={null}
{
  "request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "action": "allow",
  "result": {
    "verifiers": [
      {
        "id": "VERIFIER_ID",
        "result": "Compliant",
        "explanation": {
          "text": "The content is compliant with the policy because it does not contain any contradictions to existing policies.",
        },
        "action": "allow",
        "details": null,
        "usage": {
          "prompt_tokens": 123,
          "completion_tokens": 123,
          "total_tokens": 123
        }
      }
    ],
    "action": "allow"
  }
}
```

## API errors

The API uses standard HTTP status codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted), and codes in the 5xx range indicate an error with the API server.

| Code | Title                 | Common reason                                                                         | Common resolution                                                                |
| ---- | --------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| 400  | Bad Request           | The request could not be understood or was missing required parameters.               | Check if your request follows API documentation                                  |
| 401  | Unauthorized          | Authentication failed or user does not have permissions for the desired action.       | Check if API key is valid or resource belongs to the right team.                 |
| 403  | Forbidden             | Authentication succeeded but authenticated user does not have access to the resource. | Check if API key has required permissions or resource belongs to the right team. |
| 404  | Not Found             | The requested resource could not be found.                                            | Check if the requested resource ID is correct.                                   |
| 429  | Rate limit exceeded   | You are hitting the rate limit                                                        | Pace your requests. Our current limit is 60 requests per minute.                 |
| 500  | Internal Server Error | An error occurred on the server.                                                      | There is unexpected error on server side. Contact our support for this.          |
| 503  | Service Unavailable   | The service is not available.                                                         | Our server might be overloaded or unavailble. Contact our support for this.      |
