NAV Navbar
Ruby Python

NotifyNinja API v1

Base URL:


HTTP Authentication, scheme: Bearer



Code samples

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'

response = '',
  watcher: {
    name: 'Example',
    url: '',
    checking_delay: 240,
    is_critical: false,
    verify_ssl_certificate: false,
    verify_domain_expiration: true,
    patterns_attributes: [
      { name: '[:load_time:]', condition: 'lt', value: '500' },
      { name: '[:page_text:]', condition: 'incl', value: 'test string' },
      { name: '[:response_code:]', condition: 'eq', value: '200' }
  headers: headers

p JSON.parse(response)
import requests
import json

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'

data = {
  'watcher': {
    'name': 'Example',
    'url': '',
    'checking_delay': 240,
    'is_critical': False,
    'verify_ssl_certificate': False,
    'verify_domain_expiration': True,
    'patterns_attributes': [
      { 'name': '[:load_time:]', 'condition': 'lt', 'value': '500' },
      { 'name': '[:page_text:]', 'condition': 'incl', 'value': 'test string' },
      { 'name': '[:response_code:]', 'condition': 'eq', 'value': '200' }

response =
  data = json.dumps(data),
  headers = headers

print response.json()

Example response

Response 200 and 201

  'name': 'Example',
  'url': '',
  'checking_delay': 240,
  'is_critical': false,
  'verify_ssl_certificate': false,
  'verify_domain_expiration': true,
  'patterns': [
    ['[:load_time:]', 'lt', '500'],
    ['[:page_text:]', 'incl', 'test string'],
    ['[:response_code:]', 'eq', '200']

POST /watcher

Add watcher


Type Required Description
watcher object true -
- name string true Name of the watcher
- url string true Watcher url (example: Non validated url will return error 400
- checking_delay integer false Checking delay for watcher
- is_critical boolean false Enable phone calls and sms (if subscription level is enough)
- verify_ssl_certificate boolean false Inform if site's certificate is expired
- verify_domain_expiration boolean false Inform if site's domain name is expired
- patterns_attributes array false Checking patterns for watcher


Patterns description

Possible conditions Possible values Description
:load_time: lt; gt any value between 0 and 5000 (ms) Used to check load time of the page
:response_code: eq; neq 200; 301; 302; 401; 404; 500; 501; 502; 503 Used to check response code of the page
:page_size: lt; gt any value between 0 and 1000 (kb) Used to check page size
:page_text: incl; nincl any text value Check if page contains (or not) selected value
:any_regexp: match any regexp value Scan page with given regexp value

Conditions explanation


Errors description

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
404 Not Found -- Check path of your request.
409 Conflict -- Something wrong with the resource you are creating.
422 Unprocessable Entity -- Parameters that you have send are not enough

Usually when deal with any of mentioned errors you can read response object and find out what cause this error.

Errors explanation list: