NAV Navbar
shell
  • Introduction
  • Authentication
  • Errors
  • Pagination and Filters
  • Account
  • Alert
  • Automation
  • Broadcast
  • Event
  • Incident
  • Integration
  • Log
  • Notification
  • Router
  • Schedule
  • Stakeholder
  • Team
  • User
  • Introduction

    The PagerTree API is organized around REST. Our API has predictable, resource-oriented URLs, and uses HTTP response code to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs which are understood by off-the-shelf http clients. We support cross-origin resource sharing, allowing you to interact securely with our API from a client-side web application. JSON is returned by all API responses, including errors.

    Authentication

    JSON Web Token (JWT)

    To authenticate, use this code:

    curl -H "Content-Type: application/json" \
      -X POST \
      -d '{"username":"<username>","password":"<password>"}' \
      https://api.pagertree.com/public/login
    

    Make sure to replace <username> and <password> with your credentials. The above command returns JSON structured like this:

    {
      "token": 1
    }
    

    PagerTree uses JSON Web Tokens (JWTs) to allow access to the API. You will need to login with your user credentials using the /public/login endpoint.

    Authorization: <token>

    API Key + Secret

    Additionally, PagerTree can authenticate via API Key + Secret. To make a request using your API Key + Secret place them in the appropriate request headers.

    x-api-key: <key>

    x-api-secret: <secret>

    If you do not know where to get your API Key + Secret, please see the docs.

    curl -H "Content-Type: application/json" \
      -H "x-api-key: <key>" \
      -H "x-api-secret: <secret>" \
      https://api.pagertree.com/account/:id
    

    Make sure to replace <key> and <secret> with your api key + secret.

    Errors

    An example error message

    {
      "errors": [
        {
          "message": "'email' is a required parameter"
        }
      ],
    }
    

    PagerTree uses conventional HTTP response code to indicate the success or failure of an API request. In general: codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a wrongly formatted object, etc.). Codes in the 5xx range indicate an error with PagerTree's servers (these are rare).

    Most 4xx errors that could be handled programmatically (e.g. a bad format) include and error response that briefly explains the error.

    Error Code Meaning Description
    400 Bad Request The request was unacceptable, often due to a missing required parameter.
    401 Unauthorized A valid JSON token was not provided.
    403 Forbidden You don't have access to the resource requested.
    404 Not Found The resource does not exist.
    409 Conflict The request conflicts with another request (perhaps using the same id or key).
    429 Too Many Requests Too many request hit the API too quickly. We recommend an exponential backoff.
    500 Internal Server Error Something went wrong on PagerTree's servers. (These are rare.)

    Pagination and Filters

    All top-level API resources have support for bulk fetches via the "list" API methods. These list API methods share a common structure, taking at least these two parameters: limit and offset.

    Alternatively you may request pages by providing these two parameters: limit and page.

    Pagination Parameters

    Parameter Default Description
    limit 10 A limit on the number of objects to be returned, between 1 and 100
    offset 0 A cursor to use in pagination. The number of elements to skip.
    page 1 A cursor to use in pagination. Uses the limit to calculate current offset.

    Response Format

    Parameter Type Description
    data array The array of objects requested.
    has_more boolean Whether or not there are more elements available after this request. If false, this list comprises the end of the set.
    total_count number Number of total elements that exist.

    Filter Parameters

    For any resource you are querying via the top-level API you can pass any attributes of those objects to filter on.

    An example query url might look like the following:

    https://api.pagertree.com/user?name=austin

    You can also pass modifiers to modify the filters. The modifiers must be in the query parameter ops and have the format <attribute_name>:<operation>, where operation is any of the following:

    Operators

    Name Type Comparison
    equals === attribute === value
    ne !== attribute !== value
    lt < attribute < value
    lte <= attribute <= value
    gt > attribute > value
    gte >= attribute >= value
    beginsWith string begins with attribute.beginsWith(value)
    contains string or array contains attribute.contains(value)

    An example query url might look like the following:

    https://api.pagertree.com/user?name=austin&ops=name:beginsWith

    Sorting

    For any resource you are querying via the top-level API you can pass the sort parameter to query by sort.

    An example query url might look like the following:

    https://api.pagertree.com/user?sort=-createdAt

    Selecting

    For any resource you are querying via the top-level API you can pass the select parameter to return only certain attributes. This is highly recommended as it will speed up your querys.

    An example query url might look like the following:

    https://api.pagertree.com/user?select=sid,id

    Account

    An account represents your company organization.

    Account Object

    {
      "sid": "acc_H1fh_yx6z",
      "id": "acc_H1fh_yx6z",
      "createdAt": "2018-04-27T00:02:50.419Z",
      "updatedAt": "2018-04-27T00:03:06.098Z",
      "meta": {
        "key": "value",
        ...
      },
      "name": "PagerTree LLC",
      "token_id": "tkn_ByGE2ukxpf",
      "stripe": {
        "customer": {...},
        "subscription": {...}
      },
      "sso": {...},
      "notification_templates": {
        "alert_acknowledged": {
          "push": {
            "subject": "",
            "message": "",
          },
          "email": {
            "subject": "",
            "message": "",
          },
          "sms": {
            "message": ""
          },
          "voice": {
            "message": ""
          }
        },
        "alert_alert": {...},
        "alert_broadcast": {...},
        "alert_dropped": {...},
        "alert_handoff": {...},
        "alert_page": {...},
        "alert_rejected": {...},
        "alert_stakeholder": {...},
        "alert_timeout": {...},
        "event_goc": {...}
      }
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    name string The name of the account.
    token_id string The unique identifier of the token to use for invites to join the account.
    stripe object The Stripe customer / subscription.
    sso object Single Sign On settings.
    notification_templates object Notification templates for the different notification .type_subtype

    Retrieve an account

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/account/:id
    

    Definition

    GET https://api.pagertree.com/account/:id

    URL Parameters

    Parameter Description
    id The id of the account to retrieve

    Returns

    The newly created account object if the request succeeded. Returns an error otherwise.

    Update an account

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"name": "My new company name"}'\
      -X PUT \
      https://api.pagertree.com/account/:id
    

    Definition

    PUT https://api.pagertree.com/account/:id

    URL Parameters

    Parameter Description
    id The id of the account to update

    See the account object for all parameters.

    Returns

    The newly updated account object if the request succeeded. Returns an error otherwise.

    Alert

    An alert represents an urgent notice (state of alarm). It can also represent a broadcast, page, or stakeholder notice.

    Alert Object

    {
      "sid":"acc_H1fh_yx6z",
      "id":"alt_HJ3eGW-6M",
      "createdAt": "2018-04-27T00:02:50.419Z",
      "updatedAt": "2018-04-27T00:03:06.098Z",
      "meta": {
        "key": "value",
        ...
      },
      "tinyId": 1,
      "parent_id": "alt_xxxxxxxx",
      "thirdparty_id": "abc-123",
      "destination_ids": ["tem_xxxxxxxxx", "usr_yyyyyyyy", "rtr_zzzzzzzz"],
      "title":"CPU usage over 95%",
      "description":"PROD APP 1 CPU load over 95% for 5 minutes.",
      "type": "alert",
      "subtype": "alert",
      "status":"resolved",
      "urgency":"critical",
      "d_team_id":"tem_ByxQ3ukgTM",
      "d_user_id":"usr_r1mnuJg6z",
      "s_log_id": "log_xxxxxxxxx",
    
      "created":1524859374,
      "acknowledged":1524859483,
      "acknowledgedby": "usr_xxxxxxxx",
      "resolved":1524859487,
      "resolvedby": "usr_xxxxxxxx",
      "archived": 1524859488,
      "archivedby": "usr_xxxxxxxx",
    
      "livecall": "QU_XXXX",
    
      "source_id": "usr_r1mnuJg6z",
    
      "response_requested": false,
      "responses": ["Yes", "No", ...],
      "responses_recorded": {
        "usr_xxxxxxx": {
          "user_id": "usr_xxxxxxx",
          "value": 1,
          "recorded": 1524859488
        }
        ...
      },
    
      "tags": ["a", "tag"],
      "additional_data": [{
        "type": "text",
        "label": "Subject",
        "value": "Hello this is a subject"
      }, ...],
    
      "stakeholder_ids": ["stk_xxxxxxxxx", ...],
      "handoffs": [{
        "to": "usr_xxxxxxx",
        "from": "usr_yyyyyyy",
        "time": 1524859488,
        "acknowledged": 1524859488
      }, ...],
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    tinyId number Human friendly id.
    parent_id string Parent alert id (optional).
    thirdparty_id string A unique string mapping this to a third party system.
    destination_ids array An array containing the destinations the alert should be routed to.
    title string The title of the alert.
    description string The description of the alert.
    type string The type of alert.
    subtype string The subtype of the alert.
    status string The status of the alert.
    urgency string The urgency of the alert.
    d_team_id string The id of the team this alert has been assigned to.
    d_user_id string The id of the user this alert has been assigned to.
    s_log_id string The id of the integration log that created this alert.
    created number The unix timestamp this alert was created.
    acknowledged number The unix timestamp this alert was acknowledged.
    acknowledgedby string The id of the user this alert was acknowledged by.
    resolved number The unix timestamp this alert was resolved.
    resolvedby string The id of the user or integration this alert was resolved by.
    archived number The unix timestamp this alert was archived.
    archivedby string The id of the user this alert was archived by.
    livecall string The Twilio Queue Id of the waiting call.
    source_id string The id of the user or integration that created this alert..
    response_requested boolean For broadcasts, flag indicating if a response was requested.
    responses array Array of strings with response values.
    responses_recorded object An object containing responses of a broadcast.
    tags array An array of strings. Each string represents a tag.
    additional_data array An array of objects containing additional data from an integration.
    stakeholder_ids array An array of strings. Each a stakeholder id.
    handoffs array An array of objects containing information regarding handoffs.

    Notes

    Create an Alert

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"title":"Hello World","destination_ids: ["tem_xxxxxxxx"]"}'\
      https://api.pagertree.com/alert
    

    Definition

    POST https://api.pagertree.com/alert

    Body Parameters

    Parameter Description
    title The title of the alert.
    destination_ids An array of ids (user/team/schedule) to route the alert to.

    See the alert object for optional parameters.

    Returns

    The newly created alert object if the request succeeded. Returns an error otherwise.

    Retrieve an Alert

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/alert/:id
    

    Definition

    GET https://api.pagertree.com/alert/:id

    URL Parameters

    Parameter Description
    id The id of the alert to retrieve

    Returns

    Returns the alert object if a valid alert id was provided. Returns an error otherwise.

    Update an Alert

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"description": "Cool, that got updated"}'\
      -X PUT \
      https://api.pagertree.com/alert/:id
    

    Definition

    PUT https://api.pagertree.com/alert/:id

    URL Parameters

    Parameter Description
    id The id of the alert to update

    Body Parameters

    See the alert object for all parameters.

    Returns

    The newly updated alert object if the request succeeded. Returns an error otherwise.

    Delete an Alert

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/alert/:id
    

    Definition

    DELETE https://api.pagertree.com/alert/:id

    URL Parameters

    Parameter Description
    id The id of the alert to delete

    Returns

    A 204 - NO CONTENT on success or 404 - NOT FOUND on failure.

    List all Alerts

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/alert
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/alert

    Returns

    A paginated response with a data array property. Each item in the array is an alert object.

    Acknowledge an Alert

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X POST \
      https://api.pagertree.com/alert/:id/acknowledge
    

    Definition

    POST https://api.pagertree.com/alert/:id/acknowledge

    URL Parameters

    Parameter Description
    id The id of the alert to acknowledge

    Returns

    The newly updated alert object if the request succeeded. Returns an error otherwise.

    Notes

    The alert must be in the open or dropped status to be acknowledged. The credentials being used will be the acknowledging user.

    Reject an Alert

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X POST \
      https://api.pagertree.com/alert/:id/reject
    

    Definition

    POST https://api.pagertree.com/alert/:id/reject

    URL Parameters

    Parameter Description
    id The id of the alert to reject

    Returns

    The newly updated alert object if the request succeeded. Returns an error otherwise.

    Notes

    The alert must be in the open status and the user making the call must have an open notification workflow for this alert in order to be rejected. The credentials being used will be the rejecting user.

    Resolve an Alert

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X POST \
      https://api.pagertree.com/alert/:id/resolve
    

    Definition

    POST https://api.pagertree.com/alert/:id/resolve

    URL Parameters

    Parameter Description
    id The id of the alert to resolve

    Returns

    The newly updated alert object if the request succeeded. Returns an error otherwise.

    Notes

    The alert must be in the acknowledged status to be resolved. The credentials being used will be the resolving user.

    Archive an Alert

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X POST \
      https://api.pagertree.com/alert/:id/archive
    

    Definition

    POST https://api.pagertree.com/alert/:id/archive

    URL Parameters

    Parameter Description
    id The id of the alert to archive

    Returns

    The newly updated alert object if the request succeeded. Returns an error otherwise.

    Notes

    The alert must be in the resolved or dropped status to be archived. The credentials being used will be the archiving user.

    Handoff an Alert

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"to":"tem_xxxxxxxx"}'\
      https://api.pagertree.com/alert/:id/handoff
    

    Definition

    POST https://api.pagertree.com/alert/:id/handoff

    URL Parameters

    Parameter Description
    id The id of the alert to handoff

    Body Parameters

    Parameter Description
    to The id of the user or team to handoff the alert to.

    Returns

    The newly updated alert object if the request succeeded. Returns an error otherwise.

    Automation

    An automation is an HTTP request that can be made to thirdparty systems. Automations must be used with routes. They can dynamically run when alerts matching certain conditions are met. Think "reboot server when alert title contains '504 Gateway Timeout'".

    Automation Object

    {
      "sid":"acc_H1fh_yx6z",
      "id":"atm_HJ3eGW-6M",
      "createdAt": "2018-04-27T00:02:50.419Z",
      "updatedAt": "2018-04-27T00:03:06.098Z",
      "meta": {
        "key": "value",
        ...
      },
      "tinyId": 1,
      "name": "Reboot App Servers",
      "enabled": true,
      "settings": "
          ---
          # url (required)
          url: https://your.url
          # method (required)
          method: get
    
          # custom headers for your request (optional)
          # headers:
            # x-custom-header-1: x-custom-value-1
            # x-custom-header-2: x-custom-value-2
    
          # url parameters to be sent with the request (optional)
          # params:
            # param-name-1: param-value-1
            # param-name-2: param-value-2
    
          # data sent in request body (optional)
          # data:
            # data-name-1: data-value-1
            # data-name-2: data-value-2
    
          # basic authorization credentials (optional)
          # auth:
            # username: janedoe
            # password: s00pers3cret
        "
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    tinyId number Human friendly id.
    name string Friendly name for the automation.
    enabled boolean Flag indicating if the automation is enabled.
    settings string YAML definition for the HTTP request.

    Create an Automation

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"name":"Reboot Servers","settings: "--- yaml..."}'\
      https://api.pagertree.com/automation
    

    Definition

    POST https://api.pagertree.com/automation

    Body Parameters

    Parameter Description
    name Friendly name for the automation
    settings YAML definition for the HTTP request

    See the automation object for optional parameters.

    Returns

    The newly created automation object if the request succeeded. Returns an error otherwise.

    Retrieve an Automation

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/automation/:id
    

    Definition

    GET https://api.pagertree.com/automation/:id

    URL Parameters

    Parameter Description
    id The id of the automation to retrieve

    Returns

    Returns the automation object if a valid automation id was provided. Returns an error otherwise.

    Update an Automation

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"enabled": false}'\
      -X PUT \
      https://api.pagertree.com/automation/:id
    

    Definition

    PUT https://api.pagertree.com/automation/:id

    URL Parameters

    Parameter Description
    id The id of the automation to update

    Body Parameters

    See the automation object for all parameters.

    Returns

    The newly updated automation object if the request succeeded. Returns an error otherwise.

    Delete an Automation

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/automation/:id
    

    Definition

    DELETE https://api.pagertree.com/automation/:id

    URL Parameters

    Parameter Description
    id The id of the automation to delete

    Returns

    A 204 - NO CONTENT on success or 404 - NOT FOUND on failure.

    Notes

    This could have unintended consequences if references by routers.

    List all Automations

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/automation
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/automation

    Returns

    A paginated response with a data array property. Each item in the array is an automation object.

    Run an Automation

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X POST \
      https://api.pagertree.com/automation/:id/run
    

    Definition

    POST https://api.pagertree.com/automation/:id/run

    URL Parameters

    Parameter Description
    id The id of the automation to run

    Returns

    The log object of the run if the request succeeded. Returns an error otherwise.

    Broadcast

    A broadcast is mass alert that can be sent to users and teams. Please use the alert api as these endpoints are DEPRECATED and only provided as convinience. It's possible they be removed at any time.

    See the alert object for details.

    Create a Broadcast

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"title":"All hands on deck","destination_ids: ["tem_xxxxxxxx"]"}'\
      https://api.pagertree.com/broadcast
    

    Definition

    POST https://api.pagertree.com/broadcast

    Body Parameters

    Parameter Description
    title The title of the broadcast.
    destination_ids An array of ids (user/team) to route the broadcast to.

    See the alert object for optional parameters.

    Returns

    The newly created alert object if the request succeeded. Returns an error otherwise.

    Retrieve a Broadcast

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/broadcast/:id
    

    Definition

    GET https://api.pagertree.com/broadcast/:id

    URL Parameters

    Parameter Description
    id The id of the broadcast to retrieve

    Returns

    Returns the alert object if a valid broadcast id was provided. Returns an error otherwise.

    Delete a Broadcast

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/broadcast/:id
    

    Definition

    DELETE https://api.pagertree.com/broadcast/:id

    URL Parameters

    Parameter Description
    id The id of the broadcast to delete

    Returns

    A 204 - NO CONTENT on success or 404 - NOT FOUND on failure.

    List all Broadcasts

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/broadcast
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/broadcast

    Returns

    A paginated response with a data array property. Each item in the array is an alert object.

    Event

    An event represents a calendar event. It describes a time frame (possibly repeating) where attendees are scheduled. An event is assigned to one or more schedules.

    Event Object

    {
      "sid":"acc_H1fh_yx6z",
      "id":"evt_HJ3eGW-6M",
      "createdAt": "2018-04-27T00:02:50.419Z",
      "updatedAt": "2018-04-27T00:03:06.098Z",
      "meta": {
        "key": "value",
        ...
      },
      "tinyId": 1,
      "schedule_id": ["skd_xxxxxxxx"],
      "attendees": ["usr_xxxxxxxx", "usr_yyyyyyyy"],
      "layer": 1,
      "start": 1575964800,
      "end": 1576051200,
      "repeat": false,
      "timezone": "America/Los_Angeles",
      "dow": [0,1,2,3,4,5,6],
      "frequency": 1,
      "frequency_unit": "daily",
      "repeatend": 1576051200,
      "exceptions": [
        { "start": 1575964800, "event_id": "evt_xxxxxxx"}
        ...
      ],
      "next": {...}
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    tinyId number Human friendly id.
    schedule_id array Array of strings, schedule ids, this event belongs to.
    attendees array Array of strings, user ids, that are attending this event.
    layer number The escalation layer of this event.
    start number The unix timestamp of when this event starts
    end number The unix timestamp of when this events ends
    repeat boolean Flag indicating if this is a repeating event

    Create an Event

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"schedule_id":["skd_xxxxxxxx"],"attendees": ["usr_xxxxxxxx", "usr_yyyyyyyy"], "layer": 1, "start": 1576137600, "end": 1576224000}'\
      https://api.pagertree.com/event
    

    Definition

    POST https://api.pagertree.com/event

    Body Parameters

    Parameter Description
    schedule_id Array of schedule ids this event belongs to
    attendees Array of user ids that will be attending this event
    layer The escalation layer of the event
    start The unix timestamp of the start of the event
    end The unix timestamp of the end of the event

    See the event object for optional parameters.

    Returns

    The newly created event object if the request succeeded. Returns an error otherwise.

    Retrieve an Event

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/event/:id
    

    Definition

    GET https://api.pagertree.com/event/:id

    URL Parameters

    Parameter Description
    id The id of the event to retrieve

    Returns

    Returns the event object if a valid event id was provided. Returns an error otherwise.

    Update an Event

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"enabled": false}'\
      -X PUT \
      https://api.pagertree.com/event/:id
    

    Definition

    PUT https://api.pagertree.com/automation/:id

    URL Parameters

    Parameter Description
    id The id of the event to update

    Body Parameters

    See the event object for all parameters.

    Returns

    The newly updated event object if the request succeeded. Returns an error otherwise.

    Delete an Event

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/event/:id
    

    Definition

    DELETE https://api.pagertree.com/event/:id

    URL Parameters

    Parameter Description
    id The id of the event to delete

    Returns

    A 204 - NO CONTENT on success or 404 - NOT FOUND on failure.

    List all Events

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/event
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/event

    Returns

    A paginated response with a data array property. Each item in the array is an event object.

    Incident

    An incident is an alert that has been flagged as an incident. Please use the alert api as these endpoints are DEPRECATED and only provided as convinience. It's possible they be removed at any time.

    See the alert object for details.

    Create an Incident

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"title":"DDoS Attack","destination_ids: ["tem_xxxxxxxx"]"}'\
      https://api.pagertree.com/incident
    

    Definition

    POST https://api.pagertree.com/incident

    Body Parameters

    Parameter Description
    title The title of the alert.
    destination_ids An array of ids (user/team) to route the alert to.

    See the alert object for optional parameters.

    Returns

    The newly created alert object if the request succeeded. Returns an error otherwise.

    Retrieve an Incident

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/incident/:id
    

    Definition

    GET https://api.pagertree.com/incident/:id

    URL Parameters

    Parameter Description
    id The id of the incident to retrieve

    Returns

    Returns the alert object if a valid incident id was provided. Returns an error otherwise.

    Update an Incident

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"meta": {"incident": true, "incident_severity": "SEV-1", "incident_message": "Please call into the bridge 1-800-123-4567"}}'\
      -X PUT \
      https://api.pagertree.com/incident/:id
    

    Definition

    PUT https://api.pagertree.com/incident/:id

    URL Parameters

    Parameter Description
    id The id of the incident to update

    Body Parameters

    See the alert object for all parameters.

    Returns

    The newly updated alert object if the request succeeded. Returns an error otherwise.

    Delete an Incident

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/incident/:id
    

    Definition

    DELETE https://api.pagertree.com/incident/:id

    URL Parameters

    Parameter Description
    id The id of the alert to delete

    Returns

    A 204 - NO CONTENT on success or 404 - NOT FOUND on failure.

    List all Incidents

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/incident
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/incident

    Returns

    A paginated response with a data array property. Each item in the array is an alert object.

    Get Incident Logs

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/incident/:id/logs
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/incident/:id/logs

    URL Parameters

    Parameter Description
    id The id of the incident to get logs for

    Returns

    A paginated response with a data array property. Each item in the array is an log object.

    Integration

    An integration connects PagerTree to 3rd party applications.

    Integration Object

    {
      "sid":"acc_H1fh_yx6z",
      "id":"int_HJ3eGW-6M",
      "createdAt": "2018-04-27T00:02:50.419Z",
      "updatedAt": "2018-04-27T00:03:06.098Z",
      "meta": {
        "key": "value",
        ...
      },
      "tinyId": 1,
      "name":"Devops Email",
      "type":"email",
      "enabled":true,
      "urgency": "high",
      "destination_ids":["tem_ByxQ3ukgTM"],
      "options":{...},
    
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    tinyId number Human friendly id.
    name The name of the integration.
    type The type of the integration.
    enabled Flag indicating if the integration is currently enabled
    urgency Default urgency of alerts created by this integration
    destination_ids Array of destinations to route alerts created by this integration. Can be team, router, user, or schedule ids.
    options Integration specific options

    Create an Integration

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"name":"Email Integration", "type": "email", "destination_ids": ["tem_xxxxxxx"]}'\
      https://api.pagertree.com/integration
    

    Definition

    POST https://api.pagertree.com/integration

    Body Parameters

    Parameter Description
    name Friendly name for the integration
    type The integration type
    destination_ids The destinations to route alerts to when created by this integration

    See the integration object for optional parameters.

    Returns

    The newly created integration object if the request succeeded. Returns an error otherwise.

    Retrieve an Integration

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/integration/:id
    

    Definition

    GET https://api.pagertree.com/integration/:id

    URL Parameters

    Parameter Description
    id The id of the integration to retrieve

    Returns

    Returns the integration object if a valid integration id was provided. Returns an error otherwise.

    Update an Integration

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"enabled": false}'\
      -X PUT \
      https://api.pagertree.com/integration/:id
    

    Definition

    PUT https://api.pagertree.com/integration/:id

    URL Parameters

    Parameter Description
    id The id of the integration to update

    Body Parameters

    See the integration object for all parameters.

    Returns

    The newly updated integration object if the request succeeded. Returns an error otherwise.

    Delete an Integration

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/integration/:id
    

    Definition

    DELETE https://api.pagertree.com/integration/:id

    URL Parameters

    Parameter Description
    id The id of the integration to delete

    Returns

    A 204 - NO CONTENT on success or 404 - NOT FOUND on failure.

    Notes

    This could have unintended consequences if references by 3rd party systems.

    List all Integrations

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/integration
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/integration

    Returns

    A paginated response with a data array property. Each item in the array is an integration object.

    Log

    A log message associated with a resource.

    Log Object

    {
      "sid":"acc_H1fh_yx6z",
      "id":"log_HJ3eGW-6M",
      "createdAt": "2018-04-27T00:02:50.419Z",
      "updatedAt": "2018-04-27T00:03:06.098Z",
      "meta": {
        "key": "value",
        ...
      },
      "tinyId": 1,
      "content":"Created by usr_r1mnuJg6z",
      "type": "log",
      "subtype": "OUTGOING",
      "owner_id":"alt_H1DxGWbpG",
      "source_id": "usr_xxxxxxx",
      "level": 2
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    tinyId number Human friendly id.
    content string A message or data.
    type string The type of log
    subtype string INCOMING or OUTGOING
    owner_id string The resource that owns this log.
    source_id string The resource that created this log.
    level number The level of the log

    Create a Log

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"content":"Created by usr_r1mnuJg6z","owner_id: "alt_xxxxxxxx", "source_id": "usr_xxxxxxx"}'\
      https://api.pagertree.com/log
    

    Definition

    POST https://api.pagertree.com/log

    Body Parameters

    Parameter Description
    content A message or data
    owner_id The resource that owns this log
    source_id Who or What created this log

    See the log object for optional parameters.

    Returns

    The newly created log object if the request succeeded. Returns an error otherwise.

    Retrieve a Log

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/log/:id
    

    Definition

    GET https://api.pagertree.com/log/:id

    URL Parameters

    Parameter Description
    id The id of the log to retrieve

    Returns

    Returns the log object if a valid log id was provided. Returns an error otherwise.

    List all Logs

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/log
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/log

    Returns

    A paginated response with a data array property. Each item in the array is an log object.

    Notification

    A notification represents a message that was sent to a user on a specific channel.

    Notification Object

    {
      "sid":"acc_H1fh_yx6z",
      "id":"ntf_HJ3eGW-6M",
      "createdAt": "2018-04-27T00:02:50.419Z",
      "updatedAt": "2018-04-27T00:03:06.098Z",
      "meta": {
        "key": "value",
        ...
      },
      "thirdparty_id": "8f0f1099-bad3-4b70-b3f7-2b36f03e404e",
      "source_id": "alt_xxxxxxxx",
      "user_id": "usr_xxxxxxx",
      "group_id": "61659c96-7c96-4426-94ad-20ba6980530e",
      "workflow_id": "wkf_xxxxxxxxxx",
      "stakeholder_id": "stk_xxxxxxxxx",
      "channel":"sms",
      "provider": "twilio",
      "template": "alert.alert",
      "to": "+15303413302",
      "from": "+18175928301",
      "direction": "OUTGOING",
      "subject":"Alert #531 - CPU High",
      "message":"CPU usage over 95%",
      "cost": 0.0075,
      "status": "sent",
      "provider_status": "queued",
      "sent":1524859380,
      "delivered":1524859382,
      "err": []
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    tinyId number Human friendly id.
    thirdparty_id string Provider id for the notification
    source_id string The source of this notification
    user_id string The user this notification was routed to
    group_id string The group identifier for similar notifications
    worfklow_id string The workflow id that this notification belongs to
    stakeholder_id string The stakeholder id that this notification belongs to
    channel string The channel of this notification (push, email, sms, voice, slack)
    provider string The provider that sent this notification
    template string The template that was used for this notification
    to string The to address this notification was sent to
    from string The from address this notification was sent from
    direction string INCOMING or OUTGOING
    subject string The subject of the notification
    message string The message of the notification
    cost number The amount this notification cost
    status string PagerTree status of the notification
    provider_status string Provider status of the notification
    sent number Unix timestamp of when PagerTree sent the notification
    delivered number Unix timestamp of when the provider reported the notification delivered
    err array Array of strings describing errors

    Retrieve a Notification

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/notification/:id
    

    Definition

    GET https://api.pagertree.com/notification/:id

    URL Parameters

    Parameter Description
    id The id of the notification to retrieve

    Returns

    Returns the notification object if a valid notification id was provided. Returns an error otherwise.

    List all Notifications

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/notification
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/notification

    Returns

    A paginated response with a data array property. Each item in the array is an notification object.

    Router

    Routers are objects that can dynamically route alerts and notifications based on conditions.

    Router Object

    {
      "sid":"acc_H1fh_yx6z",
      "id":"rtr_HJ3eGW-6M",
      "createdAt": "2018-04-27T00:02:50.419Z",
      "updatedAt": "2018-04-27T00:03:06.098Z",
      "meta": {
        "key": "value",
        ...
      },
      "tinyId": 1,
      "name": "Critical Alert Routing Rules",
      "enabled": true,
      "type": "router",
      "default_receiver": "tem_xxxxxxxx",
      "rules": "
          ---
          rules:
            - match:
                alert.urgency:
                  \"$in\":
                  - critical
              actions:     
              - type: assign
                receiver: tem_yyyyyyyy
        "
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    tinyId number Human friendly id.
    name string Friendly name for the router.
    enabled boolean Flag indicating if the router is enabled.
    type string The type of router. Can be "router" or "notification".
    default_receiver string Id of the default receiver if no rules match. Only applicable to router type.
    settings string YAML definition or the router. See docs.

    Create an Router

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"name":"Critical Alert Routing Rules","settings: "--- yaml...", "type": "router", "default_receiver": "tem_xxxxxxxx"}'\
      https://api.pagertree.com/router
    

    Definition

    POST https://api.pagertree.com/router

    Body Parameters

    Parameter Description
    name Friendly name for the router
    settings YAML definition for the router
    type The router type
    default_receiver The default receiver for this router

    See the router object for optional parameters.

    Returns

    The newly created router object if the request succeeded. Returns an error otherwise.

    Retrieve an Router

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/router/:id
    

    Definition

    GET https://api.pagertree.com/router/:id

    URL Parameters

    Parameter Description
    id The id of the router to retrieve

    Returns

    Returns the router object if a valid router id was provided. Returns an error otherwise.

    Update an Router

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"enabled": false}'\
      -X PUT \
      https://api.pagertree.com/router/:id
    

    Definition

    PUT https://api.pagertree.com/router/:id

    URL Parameters

    Parameter Description
    id The id of the router to update

    Body Parameters

    See the router object for all parameters.

    Returns

    The newly updated router object if the request succeeded. Returns an error otherwise.

    Delete an Router

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/router/:id
    

    Definition

    DELETE https://api.pagertree.com/router/:id

    URL Parameters

    Parameter Description
    id The id of the router to delete

    Returns

    A 204 - NO CONTENT on success or 404 - NOT FOUND on failure.

    Notes

    This could have unintended consequences if referenced by users or integrations.

    List all Routers

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/router
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/router

    Returns

    A paginated response with a data array property. Each item in the array is an router object.

    Get Router Default Template

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/router/default-template/:type
    

    Definition

    GET https://api.pagertree.com/router/default-template/:type

    URL Parameters

    Parameter Description
    type String - router or notification

    Returns

    The default template string. Returns an error otherwise.

    Schedule

    A schedule represents an on-call schedule. It defines escalation rules and repetitions. Events and Teams point to a schedule.

    Schedule Object

    {
      "sid":"acc_H1fh_yx6z",
      "id":"skd_HJ3eGW-6M",
      "createdAt": "2018-04-27T00:02:50.419Z",
      "updatedAt": "2018-04-27T00:03:06.098Z",
      "meta": {
        "key": "value",
        ...
      },
      "tinyId": 1,
      "name": "Devops On-Call Schedule",
      "type": "on_call",
      "repeat": 0,
      "rules":[
        {
          "layer":1,
          "timeout": 5,
          "unit": "m"
        },{
          "layer":2,
          "timeout":10,
          "unit": "m"
        },{
          "layer":3,
          "timeout":15,
          "unit": "m"
        }
      ],
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    tinyId number Human friendly id.
    name string Friendly name for the on-call schedule.
    type string Type of schedule
    repeat number Number of times to repeat the rules
    rules array Escalation Rules
    enabled boolean Flag indicating if the schedule is enabled.

    Create a Schedule

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"name":"Devops On-Call Schedule"}'\
      https://api.pagertree.com/schedule
    

    Definition

    POST https://api.pagertree.com/schedule

    Body Parameters

    Parameter Description
    name Friendly name for the schedule

    See the schedule object for optional parameters.

    Returns

    The newly created schedule object if the request succeeded. Returns an error otherwise.

    Retrieve a Schedule

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/schedule/:id
    

    Definition

    GET https://api.pagertree.com/schedule/:id

    URL Parameters

    Parameter Description
    id The id of the schedule to retrieve

    Returns

    Returns the schedule object if a valid schedule id was provided. Returns an error otherwise.

    Update a Schedule

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"name": "New name"}'\
      -X PUT \
      https://api.pagertree.com/schedule/:id
    

    Definition

    PUT https://api.pagertree.com/schedule/:id

    URL Parameters

    Parameter Description
    id The id of the schedule to update

    Body Parameters

    See the schedule object for all parameters.

    Returns

    The newly updated schedule object if the request succeeded. Returns an error otherwise.

    Delete a Schedule

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/schedule/:id
    

    Definition

    DELETE https://api.pagertree.com/schedule/:id

    URL Parameters

    Parameter Description
    id The id of the schedule to delete

    Returns

    A 204 - NO CONTENT on success or 404 - NOT FOUND on failure.

    Notes

    This could have unintended consequences if referenced by teams or routers.

    List all Schedules

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/schedule
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/schedule

    Returns

    A paginated response with a data array property. Each item in the array is an schedule object.

    Get Schedule Events For Timeframe

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X POST \
      https://api.pagertree.com/schedule/:id/window-events
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    POST https://api.pagertree.com/schedule/:id/window-events?start=1576137600&end=1576224000

    URL Parameters

    Parameter Description
    id The id of the schedule

    Query Parameters

    Parameter Description
    start Unix timestamp of the start of the timeframe
    end Unix timestamp of the end of the timeframe

    Returns

    A paginated response with a data array property. Each item in the array is an event object.

    Flush a Schedule

    Deletes all events associated with a schedule

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/schedule/:id/flush
    

    Definition

    DELETE https://api.pagertree.com/schedule/:id/flush

    URL Parameters

    Parameter Description
    id The id of the schedule to flush

    Returns

    200 - OK if the request succeeded. Returns an error otherwise.

    Stakeholder

    Stakeholders are groups of people who have interest in alerts, but might not necessarily need to be in an on-call rotation. Stakeholders could be executives, product managers, or anyone who might be impacted by an alert in question.

    Stakeholder Object

    {
      "sid":"acc_H1fh_yx6z",
      "id":"stk_HJ3eGW-6M",
      "createdAt": "2018-04-27T00:02:50.419Z",
      "updatedAt": "2018-04-27T00:03:06.098Z",
      "meta": {
        "key": "value",
        ...
      },
      "tinyId": 1,
      "name": "Business Execs",
      "enabled": true,
      "user_ids": ["usr_xxxxxxxx", "usr_yyyyyyy"],
      "emails": ["amiller@pagertree.com"],
      "events": {
        "alert_assigned": false,
        "alert_acknowledged": true,
        "alert_resolved": true,
        "alert_dropped": true,
      }
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    tinyId number Human friendly id.
    name string Friendly name for the stakeholder.
    enabled boolean Flag indicating if the stakeholder is enabled.
    user_ids array Array of string user ids that belong to the stakeholder group.
    emails array Array of string email addresses that belong to the stakeholder group.
    events object Object with flags of applicable events

    Create a Stakeholder

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"name":"Business Execs","user_ids: ["usr_xxxxxx"]}'\
      https://api.pagertree.com/stakeholder
    

    Definition

    POST https://api.pagertree.com/stakeholder

    Body Parameters

    Parameter Description
    name Friendly name for the stakeholder
    user_ids Users belonging to the stakeholder group

    See the stakeholder object for optional parameters.

    Returns

    The newly created stakeholder object if the request succeeded. Returns an error otherwise.

    Retrieve a Stakeholder

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/stakeholder/:id
    

    Definition

    GET https://api.pagertree.com/stakeholder/:id

    URL Parameters

    Parameter Description
    id The id of the stakeholder to retrieve

    Returns

    Returns the stakeholder object if a valid stakeholder id was provided. Returns an error otherwise.

    Update a Stakeholder

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"enabled": false}'\
      -X PUT \
      https://api.pagertree.com/stakeholder/:id
    

    Definition

    PUT https://api.pagertree.com/stakeholder/:id

    URL Parameters

    Parameter Description
    id The id of the stakeholder to update

    Body Parameters

    See the stakeholder object for all parameters.

    Returns

    The newly updated stakeholder object if the request succeeded. Returns an error otherwise.

    Delete a Stakeholder

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/stakeholder/:id
    

    Definition

    DELETE https://api.pagertree.com/stakeholder/:id

    URL Parameters

    Parameter Description
    id The id of the stakeholder to delete

    Returns

    A 204 - NO CONTENT on success or 404 - NOT FOUND on failure.

    Notes

    This could have unintended consequences if references by teams or routers.

    List all Stakeholders

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/stakeholder
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/stakeholder

    Returns

    A paginated response with a data array property. Each item in the array is an stakeholder object.

    Team

    A team represents an actual or logical team within your organization. It is comprised of users that are called team members and usually points to a schedule as it's on-call schedule.

    Example Response

    {
      "sid": "acc_H1fh_yx6z",
      "id": "tem_ByxQ3ukgTM",
      "createdAt": "2018-04-27T00:02:51.010Z",
      "updatedAt": "2018-04-27T00:03:25.867Z",
      "meta": {
        "key": "value",
        ...
      },
      "tinyId": 1,
      "name": "Devops",
      "admin_ids": ["usr_r1mnuJg6z"],
      "member_user_ids": ["usr_r1mnuJg6z"],
      "router_id": "rtr_xxxxxxxx",
      "schedule_id": "skd_BJzQnuklaG",
      "stakeholder_ids": ["stk_xxxxxxxx"],
      "preferences": {...}
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    tinyId number Human friendly id.
    name string The name of the team.
    admin_ids array The administrators of a team
    member_user_ids array An array of user ids that are the team members of this team.
    router_id string The router id that processes incoming alerts to this team.
    schedule_id string The on-call schedule id that belongs to this team.
    stakeholder_ids array An array of stakeholder ids that are attached to alerts assigned to this team.

    Create a Team

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"name": "DevOps", "admin_ids": ["usr_r1mnuJg6z"], "member_user_ids": ["usr_r1mnuJg6z"], "schedule_id": "skd_xxxxxxxxx"}'\
      https://api.pagertree.com/team
    

    Definition

    POST https://api.pagertree.com/team

    Body Parameters

    Parameter Description
    name The name of the team.
    admin_ids The user ids of the administrators for this team
    member_user_ids The user ids of the members for this team
    schedule_id The schedule id for this team

    See the team object for optional parameters.

    Returns

    The newly created team object if the request succeeded. Returns an error otherwise.

    Retrieve a Team

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/team/:id
    

    Definition

    GET https://api.pagertree.com/team/:id

    URL Parameters

    Parameter Description
    id The id of the team to retrieve

    Returns

    Returns a team object if a valid team id was provided. Returns an error otherwise.

    Update a Team

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"stakeholder_ids": ["stk_xxxxxxx"]}'\
      -X PUT \
      https://api.pagertree.com/team/:id
    

    Definition

    PUT https://api.pagertree.com/team/:id

    URL Parameters

    Parameter Description
    id The id of the team to update

    See the team object for all parameters.

    Returns

    The newly updated team object if the request succeeded. Returns an error otherwise.

    Delete a Team

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/team/:id
    

    Definition

    DELETE https://api.pagertree.com/team/:id

    URL Parameters

    Parameter Description
    id The id of the team to delete

    Returns

    A 204 - NO CONTENT on success or 404 - NOT FOUND on failure.

    List all Teams

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/team
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/team

    Returns

    A paginated response with a data array property. Each item in the array is a team object.

    List Current Schedule Events For A Team

    A convenience method, similar to the schedule window events, that requires one less HTTP call.

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/team/:id/current-oncall
    

    The above command returns JSON structured like this:

    [
      {...event object...},
      {...event object...},
      ...
    ]
    

    Definition

    GET https://api.pagertree.com/team/:id/current-oncall

    URL Parameters

    Parameter Description
    id The id of the team to get current events for

    Returns

    An array of any events in which the team is currently on-call. Each item in the array is a event object.

    List Team Members For A Team

    A convenience method, to retrieve all user objects for a team.

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/team/:id/members
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/team/:id/members

    Returns

    A paginated response with a data array property. Each item in the array is a user object.

    User

    A user represents an actual person in your organization.

    Example Response

    {
      "sid": "acc_H1fh_yx6z",
      "id": "usr_r1mnuJg6z",
      "createdAt": "2018-04-27T00:02:50.662Z",
      "updatedAt": "2018-04-27T15:35:41.139Z",
      "meta": {
        "key": "value",
        ...
      },
      "tinyId": 1,
      "name": "Austin Miller",
      "avatar": "https://pagertree.com/assets/img/logo/pagertree-icon-256-256.png",
      "emails": [
        {
          "email": "austinrmiller1991@gmail.com",
          "verified": 1576256550,
          "blocked": false,
          "updatedat": 1576256550,
          "verificationcode": "NkSKkyHsvPaiiABMAZFsEw19yomfygsFwU4KgK3ROa27JQLi4U4l0u9KwhLV",
          "verificationcode_updatedat": 1576256550
        },
        ...
      ],
      "phones": [
        {
          "phone": "+15303413302",
          "country": "US",
          "verified": 1576256550,
          "blocked": false,
          "updatedat": 1576256550,
          "verificationcode": "NkSKkyHsvPaiiABMAZFsEw19yomfygsFwU4KgK3ROa27JQLi4U4l0u9KwhLV",
          "verificationcode_updatedat": 1576256550,
          "sms_enabled": true,
          "voice_enabled": true,
        },
        ...
      ],
      "password": "NkSKkyHsvPaiiABMAZFsEw19yomfygsFwU4KgK3ROa27JQLi4U4l0u9KwhLV",
      "slack": {...},
      "router_id": "rtr_xxxxxxx",
    
      "preferences": {
          "alert_push": true,
          "alert_email": true,
          "alert_sms": false,
          "alert_voice": false,
          "alert_slack": false,
          "alert_goc": false,
          "advanced_mode": false,
          "debug_mode": false,
          "locale": "en",
          "timezone": "America/Los_Angeles",
          "moment_format": "LLLL",
          "ui_calendar_firstday": 0,
          ...
      },
       "roles": {
           "broadcast": true,
           "admin": true,
           "admin_billing": true
       }
    }
    
    Parameter Type Description
    sid string Security identifier for the object.
    id string Unique identifier for the object.
    createdAt timestamp When this object was first created.
    updatedAt timestamp When this object last updated.
    meta object Free form metadata.
    tinyId number Human friendly id.
    name string The name of the user.
    avatar string Avatar url.
    emails array Array of email objects.
    phones array Array of phone objects.
    password string Users encrypted password. (PagerTree managed)
    slack object Slack object. (PagerTree managed)
    router_id string A route id of for notification rules for this user
    preferences object A hash of user preferences
    roles object A hash of user roles

    Create a User

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"name": "Austin Miller", "emails": [{"email": "austinrmiller1991@gmail.com"}] }'\
      https://api.pagertree.com/user
    

    Definition

    POST https://api.pagertree.com/user

    Body Parameters

    Parameter Description
    name The name of the user.
    emails The email array for the user.

    See the user object for optional parameters.

    Returns

    The newly created user object if the request succeeded. Returns an error otherwise.

    Retrieve a User

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/user/:id
    

    Definition

    GET https://api.pagertree.com/user/:id

    URL Parameters

    Parameter Description
    id The id of the user to retrieve

    Returns

    Returns a user object if a valid user id was provided. Returns an error otherwise.

    Update a User

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -d '{"name": "Austin Ryan Miller"}'\
      -X PUT \
      https://api.pagertree.com/user/:id
    

    Definition

    PUT https://api.pagertree.com/user/:id

    URL Parameters

    Parameter Description
    id The id of the user to update

    See the user object for all parameters.

    Returns

    The newly updated user object if the request succeeded. Returns an error otherwise.

    Delete a User

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X DELETE \
      https://api.pagertree.com/user/:id
    

    Definition

    DELETE https://api.pagertree.com/user/:id

    URL Parameters

    Parameter Description
    id The id of the user to delete

    Returns

    A 204 - NO CONTENT on success or 404 - NOT FOUND on failure.

    List all Users

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      https://api.pagertree.com/user
    

    The above command returns JSON structured like this:

    {
      "data": [
        {...},
        {...},
      ],
      "has_more": false,
      "total_count": 2
    }
    

    Definition

    GET https://api.pagertree.com/user

    Returns

    A paginated response with a data array property. Each item in the array is a user object.

    Add User to Teams

    Example Request

    curl -H "Content-Type: application/json" \
      -H "Authorization: <token>" \
      -X POST \
      -d '{"team_ids": ["tem_xxxxxx", "tem_yyyyyyy"] }'\
      https://api.pagertree.com/user/:id/add-to-teams
    

    Definition

    POST https://api.pagertree.com/user/:id/add-to-teams

    URL Parameters

    Parameter Description
    id The id of the automation to run

    Body Parameters

    Parameter Description
    team_ids Array of team ids to add the user to

    Returns

    200 - OK if successful. Returns an error otherwise.