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

# Check Role

> Check which roles an account holds on a stock token contract

Queries the on-chain role assignments for a specific account. When the `role` query parameter is provided, checks a single role. When omitted, returns all roles for the account.

Valid roles: `ISSUER`, `SUB_ISSUER`, `CONTROLLER`, `LEGAL_OPERATOR`.

## Path Parameters

<ParamField path="tokenAddress" type="string" required>
  Address of the stock token contract.
</ParamField>

<ParamField path="account" type="string" required>
  Ethereum address to check.
</ParamField>

## Query Parameters

<ParamField query="role" type="string">
  Specific role to check. When omitted, all roles are returned. Must be one of: `ISSUER`, `SUB_ISSUER`, `CONTROLLER`, `LEGAL_OPERATOR`.
</ParamField>

## Response Fields

<ResponseField name="success" type="boolean">Request status.</ResponseField>

<ResponseField name="data" type="object">
  Role check result. Contains either a single `hasRole` boolean or a `roles` map depending on whether a specific role was queried.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  # Check all roles
  curl "https://api.trusset.org/stocks/api/fetch/0x1234.../role/0xAbC1..." \
    -H "X-API-Key: trusset_abc123xy_secret..."

  # Check specific role
  curl "https://api.trusset.org/stocks/api/fetch/0x1234.../role/0xAbC1...?role=ISSUER" \
    -H "X-API-Key: trusset_abc123xy_secret..."
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch(
    `https://api.trusset.org/stocks/api/fetch/${tokenAddress}/role/${account}`,
    {
      headers: { 'X-API-Key': 'trusset_abc123xy_secret...' }
    }
  );
  const { data } = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Response - All Roles theme={null}
  {
    "success": true,
    "data": {
      "account": "0xAbC123dEf456789012345678901234567890AbCd",
      "roles": {
        "ISSUER": true,
        "SUB_ISSUER": false,
        "CONTROLLER": false,
        "LEGAL_OPERATOR": false
      }
    },
    "metadata": {
      "requestId": "550e8400-e29b-41d4-a716-446655440000",
      "timestamp": "2025-06-15T12:00:00.000Z",
      "instanceId": "inst_abc123"
    }
  }
  ```

  ```json Response - Single Role theme={null}
  {
    "success": true,
    "data": {
      "account": "0xAbC123dEf456789012345678901234567890AbCd",
      "role": "ISSUER",
      "hasRole": true
    },
    "metadata": {
      "requestId": "550e8400-e29b-41d4-a716-446655440000",
      "timestamp": "2025-06-15T12:00:00.000Z",
      "instanceId": "inst_abc123"
    }
  }
  ```
</ResponseExample>
