Documentation
Dispatch Police Create a new alert
The alerts endpoint allows you to dispatch police to a user given their name, phone number, and location information.
POST https://api.sendpolice.com/v1/alerts
Sandbox API: POST https://sandbox.sendpolice.com/v1/alerts
Authorization
Add your API key as a query parameter user_key
Request Parameters
Name | Type | Required | Param Location | Description | Example |
---|---|---|---|---|---|
name | string | required | request body | The user's full name that police will be dispatched to. | John Smith |
phone | string | required | request body | The user's 10 digit cell phone number. | 5555555555 |
pin | string | required | request body | The user's pin or safe word. This will be used by SendPolice to cancel false alarms. | 1234 |
location | object | either the address or location field is required | request body | The users current location in lat/lon format. | {lat: 34.32334, lon: -117.3343, accuracy: 5} |
address | object | either the address or location field is required | request body | The users current location in address format. | {addressLine1: "1234 9th Ave", addressLine2: "Unit 302", city: "San Diego", state: "CA", zip: "92101"} |
meta | object | meta and all child properties optional | request body | Additional information about the user or alert | {date_of_birth: "1982-11-25T00:00:00.000Z", email_address: "jane.smith@sample.com", home_address: { address_line_1: "1234 9th Ave", address_line_2: "Unit 302", address_line_3: "San Diego, CA 92101" }, emergency_contacts: [ { name: "John Smith", phone: "5555555555" }, { name: "Joe Smith", phone: "4444444444" } ], profile_picture_url: "https://sample.com/profile_picture", other_info: "String for additional info"} |
Sample Request (Sandbox)
//import the unirest module - make sure to install it by running "npm install unirest --save" var unirest = require('unirest'); var body = { name: "John Smith", phone: "5555555555", pin: "1234", location: { lat: 34.32334, lon: -117.3343, accuracy: 5 } }; unirest.post('https://sandbox.sendpolice.com/v1/alerts?user_key=') .type('json') .send(body) .end(function (response) { console.log(response); });
Response
Status-Code: 200 OK
{ _id: "5483f26cab16d20200eaa4fb" }
Update Location Add an updated location to an alert.
The locations endpoint allows you to add an updated location to an alert. This is useful if your users are moving when they need help.
POST https://api.sendpolice.com/v1/alerts/:alertId/locations
Sandbox API: POST https://sandbox.sendpolice.com/v1/alerts/:alertId/locations
Authorization
Add your API key as a query parameter user_key
Request Parameters
Name | Type | Required | Param Location | Description | Example |
---|---|---|---|---|---|
alertId | string | required | URL | The ID of the alert that you are adding the location to. The ID is in the response of your request to create a new alert. | 5483f26cab16d20200eaa4fb |
lat | number | required | request body | The user's current latitude. | 34.32334 |
lon | number | required | request body | The user's current longitude. | -117.3343 |
accuracy | number | required | request body | The accuracy of the location in meters. | 5 |
Sample Request (Sandbox)
//import the unirest module - make sure to install it by running "npm install unirest --save" var unirest = require('unirest'); var body = { lat: 34.32334, lon: -117.3343, accuracy: 5 }; unirest.post('https://sandbox.sendpolice.com/v1/alerts/:alertId/locations?user_key=') .type('json') .send(body) .end(function (resp) { console.log(resp); });
Response
Status-Code: 200 OK
{ _id: "5483f26cab16d20200eaa4fb" }
Cancel Alert Update the status of an alert
The statuses endpoint allows you to notify the call center to cancel the alert with the user.
POST https://api.sendpolice.com/v1/alerts/:alertId/statuses
Sandbox API: POST https://sandbox.sendpolice.com/v1/alerts/:alertId/statuses
Authorization
Add your API key as a query parameter user_key
Request Parameters
Name | Type | Required | Param Location | Description | Example |
---|---|---|---|---|---|
alertId | string | required | URL | The ID of the alert that you are adding the location to. The ID is in the response of your request to create a new alert. | 5483f26cab16d20200eaa4fb |
status | number | required | request body | The new status of the alert - the only option is to cancel the alert which is status 2. | 2 |
Sample Request (Sandbox)
//import the unirest module - make sure to install it by running "npm install unirest --save" var unirest = require('unirest'); var body = { status: 2 }; unirest.post('https://sandbox.sendpolice.com/v1/alerts/:alertId/statuses?user_key=') .type('json') .send(body) .end(function (response) { console.log(response); });
Response
Status-Code: 200 OK
{ _id: "5483f26cab16d20200eaa4fb" }