Update guest permissions
This feature allows you to modify the permissions associated with a particular guest, such as granting access to certain areas or resources. For further actions, such as inviting guests, refer to the related /invite_guest endpoint.
Request
Endpoint
PUT https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/guests/permissions/
Headers
x-api-key: {YOUR_API_KEY}
Content-Type: application/json
For details on how to authenticate your requests, please see the authentication guide.
Body
{
"guests": [
{
"id": 1234,
"permissions": []
},
{
"id": 2345,
"permissions": ["mailboxes"]
}
]
}
info
Request body is required
Request sample
Update permissions
- cURL
- Python
- Java
- Node.js
curl --request PUT \
--url "https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/guests/permissions" \
--header "x-api-key: {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--data '{
"guests": [
{
"id": 1234,
"permissions": []
},
{
"id": 2345,
"permissions": ["mailboxes"]
}
]
}'
import requests
def update_guest_permissions(company_id, guests):
url = f"https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/guests/permissions"
headers = {
"x-api-key": "{YOUR_API_KEY}",
"Content-Type": "application/json"
}
data = {
"guests": guests
}
response = requests.put(url, headers=headers, json=data)
if response.status_code == 200:
return response.json()
else:
raise Exception(f"PUT request failed: {response.status_code}, {response.text}")
if __name__ == "__main__":
try:
company_id = 123 # Example company ID
guests = [
{"id": 1234, "permissions": []},
{"id": 2345, "permissions": ["mailboxes"]}
]
data = update_guest_permissions(company_id, guests)
print("PUT 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
updateGuestPermissions(companyId);
}
public static void updateGuestPermissions(int companyId) {
try {
String url = "https://api.woodpecker.co/rest/v2/agency/companies/" + companyId + "/guests/permissions";
String jsonData = "{"
+ "\"guests\": ["
+ " { \"id\": 1234, \"permissions\": [] },"
+ " { \"id\": 2345, \"permissions\": [\"mailboxes\"] }"
+ "]"
+ "}";
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)
.header("Content-Type", "application/json")
.PUT(java.net.http.HttpRequest.BodyPublishers.ofString(jsonData))
.build();
java.net.http.HttpResponse<String> response = client.send(request, java.net.http.HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 200) {
System.out.println("PUT response: " + response.body());
} else {
System.err.println("PUT request failed: " + response.statusCode());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
const axios = require('axios');
async function updateGuestPermissions(companyId, guests) {
const url = `https://api.woodpecker.co/rest/v2/agency/companies/${companyId}/guests/permissions`;
const headers = {
'x-api-key': '{YOUR_API_KEY}',
'Content-Type': 'application/json'
};
const data = { guests: guests };
try {
const response = await axios.put(url, data, { headers });
if (response.status === 200) {
console.log('PUT response:', response.data);
} else {
console.error('PUT request failed:', response.status);
}
} catch (error) {
console.error('PUT request failed:', error.response ? error.response.status : error.message);
}
}
(async () => {
const companyId = 123; // Example company ID
const guests = [
{ id: 1234, permissions: [] },
{ id: 2345, permissions: ["mailboxes"] }
];
await updateGuestPermissions(companyId, guests);
})();
Response
Response examples
- 200
- 400
- 401
- 404
- 500
Status: 200
Body: none
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:SS UTC |
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:SS UTC |
Please review the request URL.
{
"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:SS UTC |
Unknown 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:SS UTC |