The Oh Dear Reseller API allows you to programmatically manage teams and users for your clients. This enables you to integrate Oh Dear monitoring into your existing systems and automate common tasks.
Authentication
The Reseller API uses the same authentication as the regular Oh Dear API. You'll need an API token from your reseller account with appropriate permissions.
Include your API token in the Authorization
header:
Authorization: Bearer your-api-token-here
All Reseller API endpoints are located at:
https://ohdear.app/api/reseller/{resellerTeamId}/
Replace
with your reseller team's ID.
Managed Teams
Get all managed teams
The /api/reseller/{resellerTeamId}/managed-teams
endpoint lists all teams managed by your reseller account.
$ OHDEAR_TOKEN="your API token"
$ curl https://ohdear.app/api/reseller/{resellerTeamId}/managed-teams \
-H "Authorization: Bearer $OHDEAR_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json'
Query Parameters:
filter[name]
- Filter by team name (partial match)
filter[timezone]
- Filter by timezone (exact match)
sort
- Sort by name
or created_at
(default: name
)
page
- Page number for pagination
Example Response:
{
"data": [
{
"id": 12345,
"name": "Client Company",
"timezone": "UTC",
"created_at": "2024-01-15T10:30:00.000000Z",
"monitors_count": 5
},
{
"id": 12346,
"name": "Another Client",
"timezone": "Europe/Brussels",
"created_at": "2024-01-20T14:15:00.000000Z",
"monitors_count": 12
}
],
"links": {
"first": "https://ohdear.app/api/reseller/11111/managed-teams?page=1",
"last": "https://ohdear.app/api/reseller/11111/managed-teams?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"per_page": 15,
"to": 2,
"total": 2
}
}
Create a managed team
Create a new team that will be managed by your reseller account.
Endpoint: POST /api/reseller/{resellerTeamId}/managed-teams
$ OHDEAR_TOKEN="your API token"
$ curl -X POST https://ohdear.app/api/reseller/{resellerTeamId}/managed-teams \
-H "Authorization: Bearer $OHDEAR_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "New Client Company",
"timezone": "Europe/Brussels",
"default_uptime_check_location": "paris"
}'
Request Parameters:
name
(required) - The name of the team
timezone
(optional) - Team timezone (defaults to reseller's timezone)
default_uptime_check_location
(optional) - Default uptime check location
Response:
{
"data": {
"id": 12347,
"name": "New Client Company",
"timezone": "Europe/Brussels",
"created_at": "2024-01-25T09:00:00.000000Z",
"monitors_count": 0
}
}
Get a specific managed team
Get details for a specific managed team.
Endpoint: GET /api/reseller/{resellerTeamId}/managed-teams/{managedTeamId}
$ OHDEAR_TOKEN="your API token"
$ curl https://ohdear.app/api/reseller/{resellerTeamId}/managed-teams/12345 \
-H "Authorization: Bearer $OHDEAR_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json'
Response:
{
"data": {
"id": 12345,
"name": "Client Company",
"timezone": "UTC",
"created_at": "2024-01-15T10:30:00.000000Z",
"monitors_count": 5
}
}
Add user to managed team
Add a new user to an existing managed team.
Endpoint: POST /api/reseller/{resellerTeamId}/managed-teams/{managedTeamId}/add-user
$ OHDEAR_TOKEN="your API token"
$ curl -X POST https://ohdear.app/api/reseller/{resellerTeamId}/managed-teams/12345/add-user \
-H "Authorization: Bearer $OHDEAR_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"email": "[email protected]",
"name": "Jane Smith",
"role": "member"
}'
Request Parameters:
email
(required) - Email address of the new user
name
(required) - Full name of the new user
role
(required) - User role: admin
, member
, or guest
Response:
{
"data": {
"id": 98765,
"name": "Jane Smith",
"email": "[email protected]",
"current_team_id": 12345,
"profile_photo_path": null,
"profile_photo_url": "https://www.gravatar.com/avatar/...",
"created_at": "2024-01-25T11:00:00.000000Z",
"updated_at": "2024-01-25T11:00:00.000000Z"
}
}
Managing Monitors
Once you've created managed teams, you can use the standard Oh Dear API to manage monitors for those teams. Use the team ID returned from the managed team endpoints with the regular monitors API.
For example, to create a monitor for a managed team:
$ OHDEAR_TOKEN="your API token"
$ curl -X POST https://ohdear.app/api/monitors \
-H "Authorization: Bearer $OHDEAR_TOKEN" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"team_id": 12345,
"url": "https://clientcompany.com",
"checks": ["uptime", "certificate_health", "broken_links"]
}'