> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-xsoar-8-on-prem/8.13/troubleshoot-and-reference/reference/cortex-xsoar-api.md).

# Cortex XSOAR API

Before you can begin using Cortex XSOAR APIs, you must generate the following items from Cortex XSOAR:

| Value          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **API Key**    | <p>The API Key is your unique identifier used as the <strong>Authorization:{key}</strong> header required for authenticating API calls.</p><p>Depending on your desired security level, you can generate two types of API keys, <strong>Advanced</strong> or <strong>Standard</strong>.</p><p>The <strong>Advanced</strong> key hashes the key using a nonce, a random string, and a timestamp to prevent replay attacks. cURL does not support this but it can be used with scripts.</p> |
| **API Key ID** | The API Key ID is your unique token used to authenticate the API Key. The header used when running an API call is `x-xdr-auth-id:{key_id}`.                                                                                                                                                                                                                                                                                                                                               |
| **FQDN**       | The FQDN is a unique host and domain name associated with each tenant. When you generate the API Key and Key ID, you are assigned an individual FQDN.                                                                                                                                                                                                                                                                                                                                     |

The API is documented in detail in the [Cortex XSOAR API Reference Guide](https://cortex-docs.paloaltonetworks.com/xsoar-8-api/).

Cortex XSOAR API URIs comprise of your unique FQDN, the API name, and the name of the call. For example, `https://api-{fqdn}/xsoar/{name of api}/{name of call}/`.

The following steps describe how to generate the necessary key values.

<details>

<summary>Task 1. Create an API key</summary>

1. Select Settings & Info → Settings → Integrations → **API Keys** → **New Key**.
2. Select the type of API Key you want to generate based on your desired security level: **Advanced** or **Standard**.
3. To define a time limit on the API key authentication, mark **Enable Expiration Date** and select the expiration date and time.

   You can view the **Expiration Time** field for each API key at Settings & Info → Settings → Integrations → **API Keys** . In addition, Cortex XSOAR displays an API Key Expiration notification in the Notification Center one week and one day before the defined expiration date.
4. (Optional) Provide a comment that describes the purpose of the API key.
5. Expand each area to select the desired level of access for this key.

   You can select from the list of existing **Roles**, or you can select **Custom** to set the permissions on a more granular level. You can select multiple roles.
6. Generate the API Key.
7. Copy the API key, and then click **Close**. This value represents your unique **`Authorization:{key}`**.

   <div data-gb-custom-block data-tag="hint" data-style="warning" class="hint hint-warning"><h3>Caution</h3><p>You can't view the API Key again after you complete this step so ensure that you copy it before closing the notification.</p></div>

</details>

<details>

<summary>Task 2. Get your Cortex XSOAR API key ID</summary>

1. In the API Keys table, locate the ID field.
2. Note your corresponding **ID** number. This value represents the **`x-xdr-auth-id:`*****`{key_id}`*** token.

</details>

<details>

<summary>Task 3 Get your FQDN</summary>

1. Go to Settings & Info → Settings → Integrations → **API Keys**.
2. Click **Copy API URL**

   Your FQDN is saved in the clipboard. You must use the FQDN as part of the URL in every API call. For example: `https://api-company.us.com/xsoar/public/v1/{endpoint_path}/`

</details>

<details>

<summary>Task 3 Make your first API call</summary>

The following examples vary depending on the type of key you select.

You can test authentication with Advanced API keys using the provided Python 3 example. With Standard API keys, use either the cURL example or the Python 3 example. Don’t forget to replace the example variables with your unique API key, API key ID, and FQDN tenant ID.

After you verify authentication, you can begin making API calls.

Example 34. Create an incident - Standard key cURL example

```programlisting
curl -X POST https://api-company.us.com/xsoar/public/v1/incident
-H "x-xdr-auth-id:{api_key_id}" 
-H "Authorization:{api_key}" 
-H "Content-Type:application/json" 
--data '{
"details": "My test incident",
"name": "My test incident",
"severity": 2,
"type": "Unclassified"
}'
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-xsoar-8-on-prem/8.13/troubleshoot-and-reference/reference/cortex-xsoar-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
