Docs/Reseller

Reseller API

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.

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
  }
}

Delete a managed team

Delete a managed team and all its associated data. This action cannot be undone.

Endpoint: DELETE /api/reseller/{resellerTeamId}/managed-teams/{managedTeamId}

$ OHDEAR_TOKEN="your API token"
$ curl -X DELETE https://ohdear.app/api/reseller/{resellerTeamId}/managed-teams/12345 \
    -H "Authorization: Bearer $OHDEAR_TOKEN" \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

Success Response (204):

The response will be empty with a 204 No Content status code.

Note on team deletions

When deleting a team, all its associated monitors will also be deleted. This cannot be undone. All users will be detached from this team. If the user had multiple Oh Dear teams, they will still be able to access those other teams. All pending team invitations will be revoked.

Add user to managed team

Add a user to a managed team. If a user with the given email already exists in the system, they will be added to the team. If the user is already a member of the team, a validation error will be returned.

Endpoint: POST /api/reseller/{resellerTeamId}/managed-teams/{managedTeamId}/users

$ OHDEAR_TOKEN="your API token"
$ curl -X POST https://ohdear.app/api/reseller/{resellerTeamId}/managed-teams/12345/users \
    -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

Success Response (200):

{
  "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"
  }
}

Generate a secure, time-limited login link for a user of a managed team. The link will be valid for 5 minutes and automatically log the user into their managed team context.

Endpoint: POST /api/reseller/{resellerTeamId}/managed-teams/{managedTeamId}/users/{userId}/generate-login-link

$ OHDEAR_TOKEN="your API token"
$ curl -X POST https://ohdear.app/api/reseller/{resellerTeamId}/managed-teams/12345/users/98765/generate-login-link \
    -H "Authorization: Bearer $OHDEAR_TOKEN" \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

Success Response (200):

{
  "login_url": "https://ohdear.app/reseller-login/98765/12345?expires=1640995200&signature=abc123...",
  "valid_until": "2025-01-01 12:05:00"
}

Response Fields:

  • login_url: The signed URL that the user can use to log in
  • valid_until: ISO timestamp indicating when the login link expires (Y-m-d H:i:s format)

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"]
    }'
Was this page helpful?

Feel free to reach out via [email protected] or on X via @OhDearApp if you have any other questions. We'd love to help!