# API Get Privacy Data

{% hint style="info" %}
This endpoint fetches the underlying Privacy Data from an account that has granted consent for your dApp to access.
{% endhint %}

{% hint style="info" %}
NOTE: There is a service library available to you in the [Quadrata SDK](/integration/how-to-integrate/quadrata-sdk/advanced/api-libraries/api-service-libraries/fetch-privacy-data.md), for this endpoint.
{% endhint %}

## API endpoint to get PII data that has been granted to your dApp

<mark style="color:blue;">`GET`</mark> `https://int.quadrata.com/api/v1/privacy/data/${account}`

#### Path Parameters

| Name                                      | Type | Description           |
| ----------------------------------------- | ---- | --------------------- |
| account<mark style="color:red;">\*</mark> |      | User's wallet address |

#### Query Parameters

| Name   | Type          | Description                                                                                                                                                                                                                       |
| ------ | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| scopes | List\[String] | <p>Sparse privacy scopes to fetch</p><p><code>?scopes=FN,EM</code></p><p></p><p>If not provided, all granted scopes will be returned.</p><p></p><p>Use the scope, <code>KYB\_FULL</code> , to fetch all business information.</p> |

#### Headers

| Name                                             | Type   | Description                                                                                                        |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------ |
| Authorization<mark style="color:red;">\*</mark>  |        | `Basic ${base64(apiKey)}`                                                                                          |
| Date<mark style="color:red;">\*</mark>           | String | <p>Date and time of current request</p><p><em>Wed, 04 Oct 2023 02:39:37 GMT</em></p>                               |
| X-Access-Token<mark style="color:red;">\*</mark> | String | <p>Privacy Access token</p><p><a href="/pages/2iSKper1lwSBprR5JKiG">Get Privacy Access Token</a></p>               |
| Signature<mark style="color:red;">\*</mark>      | String | [API Signed Request](/integration/how-to-integrate/request-privacy-data/api-requests/how-to-sign-api.md) Signature |

{% tabs %}
{% tab title="200: OK User PII Data" %}

```json
{
  "data": {
    "attributes": {
      "ADR": {
        "value": "address city state zip country"
      },
      "DOB": {
        "value": "1985-02-28"
      },
      "EM": {
        "value": "user@email.com"
      },
      "FN": {
        "value": "FirstName"
      },
      "G": {
        "value": "123-gov-id"
      },
      "GC": {
        "value": "class"
      },
      "GE": {
        "value": "2031-05-15"
      },
      "GI": {
        "value": "2022-02-13"
      },
      "GIS": {
        "value": "CA"
      },
      "GP": {
        "value": {
          "backPhoto": {
            "byteSize": 248197,
            "filename": "photo1.jpg",
            "url": "https://..."
          },
          "frontPhoto": {
            "byteSize": 2005573,
            "filename": "photo2.jpg",
            "url": "https://..."
          }
        }
     },
      "LN": {
        "value": "LastName"
      },
      "MN": {
        "value": "MiddleName"
      },
    },
    "type": "privacy.data"
  }
}
```

{% endtab %}

{% tab title="200: OK Business PII Data" %}

```json
{
  "data": {
    "attributes": {
      "KYB_ADR": {
        "value": {
          "address": "123 Street Adr.",
          "country": "US"
        }
      },
      "KYB_DESC": {
        "value": {
          "description": "Business Description"
        }
      },
      "KYB_NAME": {
        "value": {
          "dba": "N/A",
          "entityName": "Business Name",
          "legalName": "Business Legal Name"
        }
      },
      "KYB_PLACE": {
        "value": {
          "placesOfActivity": "Places of Activity"
        }
      },
      "KYB_PURP": {
        "value": {
          "businessPurpose": "Purpose of Passport"
        }
      },
      "KYB_TYPE": {
        "value": {
          "businessType": "CORPORATION"
        }
      },
      "KYB_FILES": {
        "value": [
          {
            "byteSize": 54964,
            "filename": "1724179911_File_Name.pdf",
            "url": "https://..."
          },
          {
            "byteSize": 1678,
            "filename": "1724179911_FORM_FIELDS.json",
            "url": "https://..."
          }
        ]
      },
      "KYB_OWNERS": {
        "value": {
          "0181c46a-4127-4f26-86ba-6c18b56f4612": {
            "attributes": {
              "ADR": {
                "value": "600 CALIFORNIA STREET SAN FRANCISCO CA 94109 US"
              },
              "DOB": {
                "value": "1977-07-17"
              },
              "EM": {
                "value": ""
              },
              "FN": {
                "value": "Firstname"
              },
              "G": {
                "value": "I1234562"
              },
              "GC": {
                "value": "dl"
              },
              "GE": {
                "value": "2029-08-20"
              },
              "GI": {
                "value": "2023-08-20"
              },
              "GIS": {
                "value": "CA"
              },
              "GP": {
                "value": {
                  "backPhoto": null,
                  "frontPhoto": {
                    "byteSize": 305982,
                    "filename": "photo1.jpg",
                    "url": "https://..."
                  }
                }
              },
              "LN": {
                "value": "Lastname"
              },
              "MN": {
                "value": "Middlename"
              },
              "SLF": {
                "value": [
                  {
                    "byteSize": 553662,
                    "page": "left_photo",
                    "url": "https://..."
                  },
                  {
                    "byteSize": 512015,
                    "page": "center_photo",
                    "url": "https://..."
                  },
                  {
                    "byteSize": 550629,
                    "page": "right_photo",
                    "url": "https://..."
                  }
                ]
              }
            },
            "type": "CONTROLLING"
          }
        }
      },
      "KYB_DATE": {
        "value": {
          "formationDate": "2022-02-04"
        }
      },
      "KYB_JUR": {
        "value": {
          "formationJurisdiction": "Formation Jurisdiction"
        }
      },
      "KYB_URL": {
        "value": {
          "website": "https://..."
        }
      },
      "KYB_WALLET": {
        "value": [
          "0x123"
        ]
      },
      "KYB_TIN": {
        "value": {
          "identificationNumber": "0123456789",
          "identificationNumberType": "TAX_IDENTIFICATION_NUMBER"
        }
      }
    },
    "type": "privacy.data"
  }
}
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
In order to authenticate properly with this endpoint, you must first request a [Privacy Access Token](/integration/how-to-integrate/request-privacy-data/api-requests/api-privacy-access-token.md).&#x20;

Privacy Access Tokens are one time use tokens. Attempting to reuse an access token will return a `401 Unauthorized` response.
{% endhint %}

## **Example With Access Token**

{% tabs %}
{% tab title="NodeJS" %}

```javascript
const buffer = require('buffer');

const privateKeyDer = '...';

// You can find `getPrivateKeyFromDer` in "How to sign API"."Full Example" page
const privateKey = await getPrivateKeyFromDer(privateKeyDer);

const walletAddress = '...';

// You can find `makeRequest` in "How to sign API"."Full Example" page
const accessResponse = await makeRequest({
    method: 'get',
    privateKey: privateKey,
    path: `/api/v1/privacy/access/${walletAddress}`
});
const { data: { authToken, accessToken } } = accessResponse;

const xAccessToken = Buffer
    .from(`${authToken}:${accessToken}`)
    .toString('base64');

const walletAddress = '...';

const json = await makeRequest({
    method: 'get',
    privateKey: privateKey,
    queryString: 'scopes=FN,EM',  // sparse scopes (optional)
    path: `/api/v1/privacy/data/${walletAddress}`,
    extraHeaders: {
        'X-Access-Token': xAccessToken
    }
});

console.log(json.data.attributes);

```

{% endtab %}

{% tab title="Python" %}

```python
"""
NOTE: you can find make_request in the full example located in the 
      API Signed Requests documentation page
"""

import base64
import json

wallet_address = '...'

# You can find `make_request` in "How to sign API"."Full Example" page
access_response = make_request(f'/api/v1/privacy/access/{wallet_address}')

auth_token = access_response['data']['authToken']
access_token = access_response['data']['accessToken']

x_access_token = base64.b64encode(
    f'{auth_token}:{access_token}'.encode('utf-8')
).decode('utf-8')

pii_response = make_request(
    query_string='scopes=FN,EM',  # sparse scopes (optional)
    path=f'/api/v1/privacy/data/{wallet_address}',
    extra_headers={
        'X-Access-Token': x_access_token
    }
)

print(json.dumps(pii_response, indent=2))
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
See [***How to sign API***](/integration/how-to-integrate/request-privacy-data/api-requests/how-to-sign-api.md) for message signing examples with more coverage and explanations.
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://docs.quadrata.com/integration/how-to-integrate/request-privacy-data/api-requests/api-get-privacy-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
