---
title: Retrieving the Authentication DSID
slug: ps/help/en_us/nsa/22x/nsa-ics/api/retrieving-the-authentication-dsid
docTags: 
createdAt: 2026-07-24T13:58:35.276Z
---

The Data Set Identification (DSID) is required for API use.

The following CURL command format uses the DSID to query the REST API server:

```python
curl -v --cookie "DSID=<value>" <api_request_url>
```

The DSID can be retrieved in two ways:

- Using the *nSA* API, see [Retrieving the DSID Using the API](docId\:aMIYczoi3ikSGBLZTBp9g).
- Using a browser, see [Retrieving the DSID Using a Browser](docId\:aMIYczoi3ikSGBLZTBp9g).

## Retrieving the DSID Using the API

You can use the following code to get a DSID token to use across all API calls:

```python
def login(url,username,password):
    tenant_url = url
    return_dict = {'status': 0}
    global user_session, dsid
    login_URL = tenant_url + '/login/admin'
    data = {
        'username': username,
        'password': password,
        'realm': 'ZTA Admin Users',
        'btnSubmit': 'Submit',
        }
    user_session = requests.session()
    r = user_session.get(url=login_URL, verify=False)
    dssignin = user_session.cookies.get('DSSIGNIN')
    data = {'username': username,'password': password,'realm': 'ZTA Admin Users','btnContinue': 
     'Continue the session'}
    login_cgi = url + '/dana-na/auth/' + dssignin + '/login.cgi'
    print login_cgi
    r = user_session.post(url=login_cgi, verify=False, data=data)
    print('login status code: ', +r.status_code)
    print('Login_data: ', user_session.cookies)
    d = str(r.content)
    if 'Continue the session' in d:
        formdatastr = xsauth = None
        try:
            p = r'.*name="FormDataStr" value="(.*?)">'
            x = re.findall(p, d)
            formdatastr = x[0]
        except IndexError:
            print 'Error: unable to get FormDataStr value'
        try:
            p = r'.*name="xsauth" value="(.*?)"'
            x = re.findall(p, d)
            xsauth = x[0]
        except IndexError:
            print 'Error: unable to get xsauth value'
        data = {'FormDataStr': formdatastr, 'xsauth': xsauth,
                'btnContinue': 'Continue the session'}
        login_cgi = url + '/dana-na/auth/' + dssignin + '/login.cgi'
        r = user_session.post(url=login_cgi, verify=False, data=data,
                              allow_redirects=True)
    dsid = user_session.cookies.get('DSID')
    print ('DSID: ', dsid)
    cookies["DSID"]=dsid
    if dsid is None:
        raise Exception('LoginError: Unable to get DSID cookie')
            # self.cookie = dsid
    session = user_session
```

After the DSID is set in the cookies (refer to code `dsid = user_session.cookies.get('DSID')`) use that session for all other API Calls.

You can use the following CURL command format uses the DSID to query the REST API server:

```python
curl -v --cookie "DSID=<value>" <api_request_url>
```

The following code demonstrates how to get a list of secure access policies using the API. It updates the cookie information for DSID from the above code.

```python
def get_secure_access_policies():
    input_payload = {"type": "application"}
    request_uri = host_url + api_version + "policies/secure-access-policies"
    output = requests.get(request_uri, params=input_payload, cookies=cookies)
    status_code = output.status_code
    response_json = output.json()
    print response_json
```

## Retrieving the DSID Using a Browser

You can use a browser to access the DSID. The procedure below describes the process for the *Chrome* browser, but any browser that offers similar tools can also be used.

:::Paragraph{listStyleType="decimal" indent="2"}
Start the *nSA* user interface in the *Chrome* browser.
:::

:::Paragraph{indent="2"}
The home page appears.
:::

:::Paragraph{listStyleType="decimal" listStart="2" listRestartPolite="2" indent="2"}
Right-click the main map, and select **Inspect** from the context menu.
:::

:::Paragraph{indent="2"}
The screen divides horizontally and the element view appears to the right of the screen.
:::

:::hint{type="info" indent="1"}
In the *Edge* browser, you click the **...** control, and then click **Other Tools > Developer Tools**. In the *Firefox* browser, you right-click and select **Inspect Element** from the context menu.
:::

:::Paragraph{listStyleType="decimal" listStart="3" listRestartPolite="3" indent="2"}
In the element view, select the **Network** tab.
:::

:::Paragraph{listStyleType="decimal" listStart="4" listRestartPolite="4" indent="2"}
Select an element from the list of elements (on the left of the tab). For example, *login*, *admin* or *subscriptions*.
:::

:::Paragraph{indent="2"}
A tab bar appears (on the right of the tab).
:::

:::Paragraph{listStyleType="decimal" listStart="5" listRestartPolite="5" indent="2"}
Select the **Cookies** tab.
:::

:::Paragraph{indent="2"}
A list of cookies for the page appears.
:::

:::Paragraph{listStyleType="decimal" listStart="6" listRestartPolite="6" indent="2"}
For the *DSID* entry, copy the DSID value and retain this value for future use. For example:
:::

::Image[]{src="https://api.archbee.com/api/optimize/wxZG1KsS4xNkVZYoiu_o9/megnV3qxCBlwDnKTkyoVW_ztachromeelements628x284.png" position="flex-start" size="63" width="628" height="284" initialPath="img/zta_chrome_elements_628x284.png" githubPath="img/zta_chrome_elements_628x284.png" showCaption="false" indent="1"}

:::Paragraph{indent="1"}
Element View in Chrome Browser
:::

You can use the following CURL command format uses the DSID to query the REST API server:

```python
curl -v --cookie "DSID=<value>" <api_request_url>
```
