Get a list of company users
Retrieve details of users under a specific company, including their ID, name, email, roles, and guest permissions.
Request
Endpoint
GET https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/users
Headers
x-api-key: {YOUR_API_KEY}
For details on how to authenticate your requests, please see the authentication guide.
Parameters
| Parameter | Required | Type | Description | 
|---|---|---|---|
| company_id | Yes | integer | Path parameter - the ID of the company for which the users will be returned | 
| page | No | integer | Requested results page (1-based) | 
| role | No | string | Filter by user role: admin,owner,guest,authorized_team_member | 
Request samples
Get a list of company users
- cURL
- Python
- Java
- Node.js
- PHP
curl --request GET \
  --url "https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/users" \
  --header "x-api-key: {YOUR_API_KEY}"
import requests
def get_users(company_id):
  url = f"https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/users"
  headers = {
    "x-api-key": "{YOUR_API_KEY}"
  }
  
  response = requests.get(url, headers=headers)
  if response.status_code == 200:
    return response.json()
  else:
    raise Exception(f"GET request failed: {response.status_code}, {response.text}")
if __name__ == "__main__":
  try:
    company_id = 123  # Example company ID
    data = get_users(company_id)
    print("GET response:", data)
  except Exception as e:
    print("Error:", e)
public class WoodpeckerApiClient {
  private static final String API_KEY = "{YOUR_API_KEY}";
  public static void main(String[] args) {
    int companyId = 123; // Example company ID
    getUsers(companyId);
  }
  public static void getUsers(int companyId) {
    try {
      String url = "https://api.woodpecker.co/rest/v2/agency/companies/" + companyId + "/users";
      java.net.http.HttpClient client = java.net.http.HttpClient.newHttpClient();
      java.net.http.HttpRequest request = java.net.http.HttpRequest.newBuilder()
        .uri(new java.net.URI(url))
        .header("x-api-key", API_KEY)
        .GET()
        .build();
      java.net.http.HttpResponse<String> response = client.send(request, java.net.http.HttpResponse.BodyHandlers.ofString());
      if (response.statusCode() == 200) {
        System.out.println("GET response: " + response.body());
      } else {
        System.err.println("GET request failed: " + response.statusCode());
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
const axios = require('axios');
async function getUsers(companyId) {
  const url = `https://api.woodpecker.co/rest/v2/agency/companies/${companyId}/users`;
  const headers = {
    'x-api-key': '{YOUR_API_KEY}'
  };
  try {
    const response = await axios.get(url, { headers });
    console.log('GET response:', response.data);
  } catch (error) {
    console.error('GET request failed:', error.response ? error.response.status : error.message);
  }
}
(async () => {
  const companyId = 123; // Example company ID
  await getUsers(companyId);
})();
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new Client([
  'base_uri' => 'https://api.woodpecker.co/rest/v2/',
  'headers'  => ['x-api-key' => getenv('WOODPECKER_API_KEY')],
]);
$companyId = '{COMPANY_ID}';
try {
  $response = $client->get("agency/companies/{$companyId}/users");
  echo $response->getStatusCode(), "\n";
  echo $response->getBody(), "\n";
} catch (RequestException $e) {
  echo "Error: ", $e->getMessage(), "\n";
  if ($e->hasResponse()) {
    echo $e->getResponse()->getBody(), "\n";
  }
}
Response
Response examples
- 200
- 400
- 401
- 404
- 500
A list of company users
{
  "content": [
    {
      "id": 1234,
      "name": "Michael Scott",
      "email": "michael@dundermifflin.com",
      "roles": ["admin"],
      "guest_permissions": []
    },
    {
      "id": 1235,
      "name": "Jim Halpert",
      "email": "jimothy@dundermifflin.com",
      "roles": ["admin", "owner"],
      "guest_permissions": []
    },
    {
      "id": 1236,
      "name": "Bob Vance",
      "email": "bob.vance@vancerefrigeration.com",
      "roles": ["guest"],
      "guest_permissions": ["mailboxes"]
    },
    {
      "id": 1237,
      "name": "Pam Beesly",
      "email": "pam@dundermifflin.com",
      "roles": ["authorized_team_member"],
      "guest_permissions": []
    }
  ],
  "pagination_data": {
    "total_elements": 4,
    "total_pages": 1,
    "current_page_number": 1,
    "page_size": 50
  }
}
Body schema
| Field | Type | Description | 
|---|---|---|
| content | array[object] | List of all users with access to the specific company | 
| └─ [].id | integer | Unique user ID | 
| └─ [].name | string | User's full name | 
| └─ [].email | string | User's email | 
| └─ [].roles | array[string] | List of roles assigned to a user. More about roles here 
 | 
| └─ guest_permissions | array[string] | mailboxes- whether a guest user can add/remove their mailboxes. Empty array for non-guests or guest without permission | 
| pagination_data | object | Pagination information. See the pagination section | 
Invalid request parameters or malformed request syntax.
{
  "title": "Bad request",
  "status": 400,
  "detail": "string",
  "timestamp": "2025-03-05 17:57:00"
}
Body schema
| Field | Type | Description | 
|---|---|---|
| title | string | A short title describing the error | 
| status | integer | The HTTP status code | 
| detail | string | A detailed message explaining the error | 
| timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SSUTC | 
An issue with authorization. Please review the authorization guide
{
  "title": "Unauthorized",
  "status": 401,
  "detail": "Invalid api key",
  "timestamp": "2025-03-05 17:57:00"
}
Body schema
| Field | Type | Description | 
|---|---|---|
| title | string | A short title describing the error | 
| status | integer | The HTTP status code | 
| detail | string | A detailed message explaining the error | 
| timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SSUTC | 
The requested company does not exists, or the request URL is incorrect
{
  "title": "Not Found",
  "status": 404,
  "detail": "Requested resource does not exist",
  "timestamp": "2025-03-05 17:57:00"
}
Body schema
| Field | Type | Description | 
|---|---|---|
| title | string | A short title describing the error | 
| status | integer | The HTTP status code | 
| detail | string | A detailed message explaining the error | 
| timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SSUTC | 
Unexpected error, please try again later
{
  "title": "Internal server error",
  "status": 500,
  "detail": "An unexpected error has occurred. Please try again later.",
  "timestamp": "2025-03-05 17:57:00"
}
Body schema
| Field | Type | Description | 
|---|---|---|
| title | string | A short title describing the error | 
| status | integer | The HTTP status code | 
| detail | string | A detailed message explaining the error | 
| timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SSUTC | 
Pagination
The response body contains pagination details. It will support you in navigating through larger datasets.
Use page parameter to view a specific page.
info
Each page contains up to 50 users
{
  "content": [],
  "pagination_data": {
    "total_elements": 501,
    "total_pages": 11,
    "current_page_number": 3,
    "page_size": 50
  }
}
| Field | Type | Description | 
|---|---|---|
| pagination_data | object | Pagination information | 
| └─ total_elements | integer | Total number of users | 
| └─ total_pages | integer | Total number of available pages | 
| └─ current_page_number | integer | Current page number (1-based) | 
| └─ page_size | integer | Maximum number of items per page |