> For the complete documentation index, see [llms.txt](https://docs.nexthink.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexthink.com/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/api-and-integrations-classic/other-integrations-classic/getsid-api-classic.md).

# GetSID API (classic)

## Overview <a href="#getsidapi-classic-overview" id="getsidapi-classic-overview"></a>

The *GetSID API* lets you retrieve the Security Identifier (SID) of end users.

Because [triggering a campaign via the Engage API](https://docs.nexthink.com/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/api-and-integrations-classic/other-integrations-classic/triggering-remote-actions-via-their-api-classic.md) requires the SID of the targeted users as a parameter, the GetSID API is specially useful for automatically triggering campaigns from environments where the SID of users is not readily available.

## Calling the GetSID API <a href="#getsidapi-classic-callingthegetsidapi" id="getsidapi-classic-callingthegetsidapi"></a>

The Portal exposes the Engage API as a REST API under the URL:

`https://[portal.company.com]/api/inventory/v1/getusersid`

In the URL, substitute `[portal.company.com]` for the external DNS name of your Portal.

To get the SID of an end user, submit a POST request to the URL of the API (note that GET requests are not supported, returning a 404 error) with a JSON payload encoded in UTF-8 that contains two parameters:

| Name          | Description                                                                                                                                                                                                                    |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `fieldName`   | <p>Name of the field that serves to retrieve the user. Look for users either by:</p><ul><li><strong>name</strong>: User logon name.</li><li><strong>dn</strong>: Distinguished name of the user in Active Directory.</li></ul> |
| `fieldValues` | List of values to search on the specified field (currently limited to 1 element).                                                                                                                                              |

Example of the JSON payload of a request to the API of Engage:

```
{
 "fieldName": "name",
 "fieldValues" : ["foobarUser@example.com"]
}
```

### HTTP headers <a href="#getsidapi-classic-httpheaders" id="getsidapi-classic-httpheaders"></a>

Send your POST request to the GetSID API with the following HTTP headers to specify JSON content and basic authentication:

`Content-type: application/json`

`Authorization: Basic [base-64(user:password)]`

Replace `[base-64(user:password)]` with the credentials (in base-64 encoding) of a Nexthink user who has the right to access the API for triggering campaigns.

### Error conditions <a href="#getsidapi-classic-errorconditions" id="getsidapi-classic-errorconditions"></a>

In response to a request, the Portal may send one of the following answers if something goes wrong:

| Error type       | HTTP code                 | Cause                                                                                                                                                                                       |
| ---------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Access Denied    | Unauthorized 401          | <ul><li>Authentication error</li></ul>                                                                                                                                                      |
| Validation error | Bad request 400           | <ul><li>Invalid JSON</li><li>Invalid encoding</li><li>Invalid Content-type</li><li>Missing or invalid <code>fieldName</code></li><li>Missing or too many <code>fieldValues</code></li></ul> |
| Unknown error    | Internal server error 500 | <ul><li>Undefined internal error</li></ul>                                                                                                                                                  |

***

RELATED TASK

* [Triggering campaigns via their API](https://docs.nexthink.com/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/api-and-integrations-classic/other-integrations-classic/triggering-remote-actions-via-their-api-classic.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.nexthink.com/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/api-and-integrations-classic/other-integrations-classic/getsid-api-classic.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
