> ## 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.

# Get Access Role

> Check whether an address holds a role on the market, its router or its oracle

Reads from the chain whether an address holds one of the six roles that [Set Access Role](/endpoints/lending/set-access-role) grants and revokes. Use it before building a change, or to confirm which wallet can sign an administrative transaction.

For `ORACLE_SIGNER`, the oracle owner reads as granted, because the owner can sign prices without a grant.

## Path Parameters

<ParamField path="marketId" type="string" required>Market ID.</ParamField>

<ParamField path="address" type="string" required>
  Address to check. Must be a 0x-prefixed 40-character hex address other than the zero address.
</ParamField>

## Query Parameters

<ParamField query="role" type="string" required>
  One of `MARKET_ADMIN`, `MARKET_ISSUER`, `MARKET_LIQUIDATOR`, `ROUTER_ADMIN`, `ROUTER_OPERATOR` or `ORACLE_SIGNER`. The [role table](/endpoints/lending/set-access-role#roles) says what each one controls.
</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="address" type="string">The address checked, echoed back as sent.</ResponseField>
    <ResponseField name="role" type="string">The role key checked.</ResponseField>
    <ResponseField name="roleName" type="string">The on-chain role: `DEFAULT_ADMIN_ROLE`, `ISSUER_ROLE`, `LIQUIDATOR_ROLE`, `OPERATOR_ROLE`, or `Price signing` for `ORACLE_SIGNER`.</ResponseField>
    <ResponseField name="contract" type="string">The contract the role was read from: the market, its liquidation router or its oracle.</ResponseField>
    <ResponseField name="granted" type="boolean">Whether the address holds the role. `null` when the chain read failed.</ResponseField>
    <ResponseField name="failed" type="boolean">`true` when the role could not be read from the chain.</ResponseField>
  </Expandable>
</ResponseField>

<Warning>
  A failed chain read still returns `200`, with `granted: null` and `failed: true`. Treat it as unknown, not as a revoked role, and retry.
</Warning>

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/access-role/0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27?role=ROUTER_OPERATOR" \
    -H "X-API-Key: trusset_your_key_here"
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/access-role/${address}?role=ROUTER_OPERATOR`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "address": "0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27",
      "role": "ROUTER_OPERATOR",
      "roleName": "OPERATOR_ROLE",
      "contract": "0x8c3a5e0f2b71d94c6e08a3f5b2d7c19e4a60f835",
      "granted": true,
      "failed": false
    }
  }
  ```

  ```json Response - Unreadable theme={null}
  {
    "success": true,
    "data": {
      "address": "0x5b7e2d91c04a38f6e1d9a72b3c8f40e6d15a9c27",
      "role": "ROUTER_OPERATOR",
      "roleName": "OPERATOR_ROLE",
      "contract": "0x8c3a5e0f2b71d94c6e08a3f5b2d7c19e4a60f835",
      "granted": null,
      "failed": true
    }
  }
  ```

  ```json Error - Unknown Role theme={null}
  {
    "success": false,
    "error": {
      "code": "UNKNOWN_ROLE",
      "message": "A supported role is required"
    }
  }
  ```
</ResponseExample>

## Error Codes

| Code                | HTTP  | Cause                                                                                                 |
| ------------------- | ----- | ----------------------------------------------------------------------------------------------------- |
| `NO_MARKET_ADDRESS` | `400` | The market has no on-chain address recorded, or no market address could be resolved for a market role |
| `INVALID_ADDRESS`   | `400` | The path address is malformed or is the zero address                                                  |
| `UNKNOWN_ROLE`      | `400` | `role` is missing or is not one of the six keys                                                       |
| `NO_ROUTER`         | `400` | A router role was requested and no liquidation router address could be resolved for the market        |
| `NO_ORACLE`         | `400` | `ORACLE_SIGNER` was requested and the market records no oracle                                        |
| `MISSING_MARKET_ID` | `400` | `marketId` is longer than 100 characters                                                              |
| `MARKET_NOT_FOUND`  | `404` | No market with this ID on your instance                                                               |
