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

# List Roles

> List all roles in an organization

## Path Parameters

<ParamField path="organizationId" type="string" required>
  Organization ID
</ParamField>

## Query Parameters

<ParamField query="limit" type="number">
  Items per page (default: 20)
</ParamField>

<ParamField query="lastKey" type="string">
  Cursor for pagination (from previous response)
</ParamField>

<ParamField query="search" type="string">
  Search term for name/description
</ParamField>

## Response

Returns a paginated list of Role objects.

```json theme={null}
{
  "data": [
    {
      "id": "role123",
      "name": "editor",
      "description": "Content management with publishing rights",
      "permissions": {
        "organizations": { "read": true, "update": false, "delete": false },
        "projects": { "create": false, "read": true, "update": false, "delete": false },
        "content": { "create": true, "read": true, "update": true, "publish": true, "delete": true },
        "assets": { "create": true, "read": true, "update": true, "delete": true }
      },
      "createdAt": "2024-03-20T10:00:00Z",
      "updatedAt": "2024-03-20T10:00:00Z"
    }
  ],
  "pagination": {
    "lastKey": "role456"
  }
}
```

## Code Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.metabind.ai/app/v1/organizations/org123/roles" \
    -H "Authorization: Bearer YOUR_JWT"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api.metabind.ai/app/v1/organizations/org123/roles',
    {
      headers: {
        'Authorization': 'Bearer YOUR_JWT'
      }
    }
  );

  const { data } = await response.json();
  console.log(`Found ${data.length} roles`);
  ```

  ```swift Swift theme={null}
  let url = URL(string: "https://api.metabind.ai/app/v1/organizations/org123/roles")!
  var request = URLRequest(url: url)
  request.setValue("Bearer YOUR_JWT", forHTTPHeaderField: "Authorization")

  let (data, _) = try await URLSession.shared.data(for: request)
  let result = try JSONDecoder().decode(RoleListResponse.self, from: data)
  ```

  ```kotlin Kotlin theme={null}
  val response = client.get("https://api.metabind.ai/app/v1/organizations/org123/roles") {
      header("Authorization", "Bearer YOUR_JWT")
  }

  val result = response.body<RoleListResponse>()
  println("Found ${result.data.size} roles")
  ```
</CodeGroup>
