Skip to content

Instantly share code, notes, and snippets.

@noob-master147
Created January 19, 2022 09:43
Show Gist options
  • Save noob-master147/29ea99b56e61a939584377570d3b5140 to your computer and use it in GitHub Desktop.
Save noob-master147/29ea99b56e61a939584377570d3b5140 to your computer and use it in GitHub Desktop.
insomnia spike open api
openapi: '3.0.2'
info:
title: Spike.sh API
description: Integrate Spike.sh with your API
version: '1.0.0'
servers:
- url: http://localhost:2222/
- url: https://api.spike.sh/
components:
parameters:
# Authentication with API key
authHeader:
description: API Key
in: header
name: x-api-key
required: true
schema:
type: string
format: uid
# Team in header
teamHeader:
description: Team ID
in: header
name: x-team-id
required: true
schema:
type: string
format: uid
# counter_id
counterId:
description: counterId
required: true
in: path
name: counterId
schema:
type: number
format: number
# _id
_id:
description: Unique id
required: true
in: path
name: _id
schema:
type: string
format: string
paths:
##################
#
# Org
#
##################
/orgs/info:
get:
tags:
- Org
summary: Fetch your org info
description: >
Get basic information about your org
parameters:
- $ref: '#/components/parameters/authHeader'
responses:
'200':
description: Gets basic info
'401':
description: Unauthorized access
/orgs/members:
get:
tags:
- Org
summary: Fetch members in your org
description: >
Get detailed information about members (including removed members) in your org on Spike.sh
parameters:
- $ref: '#/components/parameters/authHeader'
responses:
'200':
description: Array of members
'401':
description: Unauthorized access
##################
#
# Teams
#
##################
/teams/get-all-teams:
get:
tags:
- Teams
summary: Fetch all the teams
description: >
Get All the teams belonging to an org
parameters:
- $ref: '#/components/parameters/authHeader'
responses:
'200':
description: Gets basic info
'401':
description: Unauthorized access
/teams/get-my-teams:
get:
tags:
- Teams
summary: Fetch all the teams you are part of
description: >
Get All the teams you are a part of
parameters:
- $ref: '#/components/parameters/authHeader'
- in: query
name: id
description: User `_id` in query parameters
required: true
schema:
type: string
responses:
'200':
description: Gets basic info
'401':
description: Unauthorized access
##################
#
# Escalations
#
##################
/escalations:
get:
tags:
- Escalations
summary: Fetch list of escalations
description: >
[An escalation policy](https://docs.spike.sh/escalations/introduction-to-escalations) is a simple set of rules to alert the right person at the right time using the right channel such as phone, slack or email. If that person misses out then the incident gets escalated to the next person.
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
responses:
'200':
description: Gets all escalations for a team
'401':
description: Unauthorized access
/escalations/{_id}:
get:
tags:
- Escalations
summary: Get escalation policy details
description: >
Get escalation details
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- $ref: '#/components/parameters/_id'
responses:
'200':
description: Get escalation details
'401':
description: Unauthorized access
/escalations/create:
post:
tags:
- Escalations
summary: Create an escalation policy
description: >
Creates an escalation policy.
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
desc:
type: string
escalation:
type: array
required:
- name
- escalation
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
desc:
type: string
escalation:
type: array
required:
- name
- escalation
responses:
'200':
description: Create a new escalation
'401':
description: Unauthorized access
/escalations/{_id}/update:
put:
tags:
- Escalations
summary: Update an escalation policy
description: >
Updates an escalation policy.
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- $ref: '#/components/parameters/_id'
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
desc:
type: string
escalation:
type: array
required:
- name
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
desc:
type: string
required:
- name
responses:
'200':
description: Updates an existing escalation
'401':
description: Unauthorized access
/escalations/{_id}/archive:
delete:
tags:
- Escalations
summary: Archive an escalation policy
description: >
Archives an escalation policy.
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- $ref: '#/components/parameters/_id'
responses:
'200':
description: Archives an existing escalation
'401':
description: Unauthorized access
##################
#
# +++ Incidents +++
#
##################
# incident basics
/incidents:
get:
tags:
- Incidents
summary: Fetch incidents
description: >
Get all incidents
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
responses:
'200':
description: Array of incidents
'401':
description: Unauthorized access
/incidents/assigned-to-user:
get:
tags:
- Incidents
summary: Fetch incidents assigned to a user
description: >
Get all incidents assigned to a user
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
responses:
'200':
description: Array of incidents
'401':
description: Unauthorized access
/incidents/{counterId}:
get:
tags:
- Incidents
summary: Fetch incident info
description: >
Get in-depth information about an incident
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- $ref: '#/components/parameters/counterId'
responses:
'200':
description: >
In-depth info contains `title`, `metadata`, priority, severity, and activity log
/incidents/triggered:
get:
tags:
- Incidents
summary: Fetch all the triggered incidents
description: >
Get in-depth information about an incident
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
responses:
'200':
description: >
Get all the incidents that are in triggered state
/incidents/acknowledged:
get:
tags:
- Incidents
summary: Fetch all the acknowledged incidents
description: >
Get in-depth information about all acknowledged incident
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
responses:
'200':
description: >
Get all the incidents that are in acknowledged state
/incidents/create:
post:
tags:
- Incidents
summary: Create an incident
description: >
Creates an incident and sends alerts. Accepts escalation `_id`, integration `token` along with priority and severity.
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
title:
type: string
description: The title of incident will be listed in incidents table, used in alert channels like Phone, SMS, Slack etc.
metadata:
type: string
description: Send an Object of details to be shown incident details section
escalation:
type: string
description: Accepts escalation `_id` only
integration:
type: string
description: Accepts integration `token` only
priority:
type: string
description: Accepts one of `p1, p2, p3, p4, p5` only
severity:
type: string
description: Accepts one of `sev1, sev2, sev3` only
required:
- title
- escalation
- integration
responses:
'200':
description: Array of incidents
'401':
description: Unauthorized access
# Actions on incidents
/incidents/acknowledge:
post:
tags:
- Actions on incidents
summary: Acknowledge incident
description: >
**Acknowledge** one or more incidents. If any incident's integration has [Acknowledge Timeout](https://docs.spike.sh/incidents/acknowledge-timeout) set, it will come into play. Accepts an array of incident counter ids (*116, prim-122*).
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
ids:
type: array
description: Send incident counter ids
responses:
'200':
description: Confirmation only
'401':
description: Unauthorized access
/incidents/resolve:
post:
tags:
- Actions on incidents
summary: Resolve incident
description: >
**Resolves** one or more incidents. Accepts an array of incident counter ids (*116, prim-122*).
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
ids:
type: array
description: Send incident counter ids
responses:
'200':
description: Confirmation only
'401':
description: Unauthorized access
/incidents/unacknowledge:
post:
tags:
- Actions on incidents
summary: Unacknowledge incident
description: >
**Unacknowledge** one or more incidents. Accepts an array of incident counter ids (*116, prim-122*).
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
ids:
type: array
description: Send incident counter ids
responses:
'200':
description: Confirmation only
'401':
description: Unauthorized access
/incidents/escalate:
post:
tags:
- Actions on incidents
summary: Escalate incident
description: >
**Escalates** one or more incidents. Accepts an array of incident counter ids (*116, prim-122*).
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
ids:
type: array
description: Send incident counter ids
responses:
'200':
description: Confirmation only
'401':
description: Unauthorized access
# Durable actions
/incidents/priority:
post:
tags:
- Actions on incidents
summary: Set priority
description: >
Adds **Priority** to one or more incidents. Accepts an array of incident counter ids (*116, prim-122*). Priority can belong to one of `p1, p2, p3, p4, p5` values. Learn more about [priority](https://docs.spike.sh/incidents/priority-and-severity)
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
ids:
type: array
responses:
'200':
description: Confirmation only
'401':
description: Unauthorized access
/incidents/priority/remove:
delete:
tags:
- Actions on incidents
summary: Remove priority
description: >
**Removes Priority** to one or more incidents. Accepts an array of incident counter ids (*116, prim-122*).
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
ids:
type: array
description: Send incident counter ids
responses:
'200':
description: Confirmation only
'401':
description: Unauthorized access
/incidents/severity:
post:
tags:
- Actions on incidents
summary: Set severity
description: >
Adds **Severity** to one or more incidents. Accepts an array of incident counter ids (*116, prim-122*). Severity can belong to one of `sev1, sev2, sev3` values. Learn more about [severity](https://docs.spike.sh/incidents/priority-and-severity)
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
ids:
type: array
description: Send incident counter ids
responses:
'200':
description: Confirmation only
'401':
description: Unauthorized access
/incidents/severity/remove:
delete:
tags:
- Actions on incidents
summary: Remove severity
description: >
**Removes Severity** to one or more incidents. Accepts an array of incident counter ids (*116, prim-122*).
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
ids:
type: array
description: Send incident counter ids
responses:
'200':
description: Confirmation only
'401':
description: Unauthorized access
/incidents/{counterId}/public-sharing:
patch:
tags:
- Actions on incidents
summary: Enable/Disable public sharing
description: >
Enable/Disable public sharing for an incident. If enabled, you will get the public url in response. Learn more about [public sharing](https://docs.spike.sh/incidents/sharing-incidents)
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- $ref: '#/components/parameters/counterId'
requestBody:
content:
application/json:
schema:
type: object
properties:
publicSharing:
type: boolean
responses:
'200':
description: If enabled, you will get the public url for an incident
'401':
description: Unauthorized access
# Suppressed incidents
/incidents/{counterId}/suppressed-incidents:
get:
tags:
- Suppressed incidents
summary: Fetch suppressed incidents
description: >
Fetches suppressed incidents for an incident.
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- $ref: '#/components/parameters/counterId'
responses:
'200':
description: List of suppressed incidents
'401':
description: Unauthorized access
/incidents/{counterId}/suppressed-incidents/{_id}:
get:
tags:
- Suppressed incidents
summary: Fetch a suppressed incident
description: >
Fetches a suppressed incident with it's details for an incident.
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- $ref: '#/components/parameters/counterId'
- $ref: '#/components/parameters/_id'
responses:
'200':
description: List of suppressed incidents
'401':
description: Unauthorized access
##################
#
# Services
#
##################
/services:
get:
tags:
- Services
summary: Fetch all services
description: >
Get services for a team. Services are scopes for multiple integrations and their incidents.
externalDocs:
description: Learn more about services
url: https://docs.spike.sh/services/introduction-to-services-on-spike
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
responses:
'200':
description: Get all services
'401':
description: Unauthorized access
/services/{counterId}:
get:
tags:
- Services
summary: Fetch service details with incidents
description: >
Get in-depth details about a service. This route will also list out all incidents for the given service
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- $ref: '#/components/parameters/counterId'
responses:
'200':
description: Get a single service
'401':
description: Unauthorized access
/services/affected:
get:
tags:
- Services
summary: Fetch currently affected services
description: >
Get in-depth details about all affected services.
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
responses:
'200':
description: Get a single service
'401':
description: Unauthorized access
/services/{counterId}/incidents:
get:
tags:
- Services
summary: Fetch incidents for a service
description: >
Get incidents for a service. This is very similar to getting sevice in-depth route above.
externalDocs:
description: Learn more about incidents
url: https://docs.spike.sh/incidents/what-is-an-incident
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- in: path
name: counterId
required: true
schema:
type: string
format: string
description: service `counterId`
responses:
'200':
description: Get incidents for a service
'401':
description: Unauthorized access
/services/{counterId}/integrations:
get:
tags:
- Services
summary: Fetch integrations of a service
description: >
Get all integrations for a service. You will get the list of integrations with their respective webhooks
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- in: path
name: counterId
required: true
schema:
type: string
format: string
description: service `counterId`
responses:
'200':
description: Get integrations for a service
'401':
description: Unauthorized access
/services/create:
post:
tags:
- Services
summary: Creates a service
description: >
Creates a new service in a team
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
desc:
type: string
required:
- name
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
desc:
type: string
required:
- name
responses:
'200':
description: Creates and returns your new service.
'401':
description: Unauthorized access
/services/{counterId}/update:
put:
tags:
- Services
summary: Updates a service
description: >
Update your service name and description only
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- $ref: '#/components/parameters/counterId'
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
desc:
type: string
required:
- name
application/x-www-form-urlencoded:
schema:
type: object
properties:
name:
type: string
desc:
type: string
required:
- name
responses:
'200':
description: Creates and returns your new service.
'401':
description: Unauthorized access
###############
#
# On-calls
#
###############
## On-calls CRUD
/on-calls:
get:
tags:
- On-call
summary: Fetch on-call
description: >
Get all on-calls
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
responses:
'200':
description: Array of on-calls
'401':
description: Unauthorized access
/on-calls/{_id}:
get:
tags:
- On-call
summary: Fetch an on-call
description: >
Get all on-calls
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- $ref: '#/components/parameters/_id'
responses:
'200':
description: Get on-call details with layers, shifts, and users
'401':
description: Unauthorized access
/on-calls/{_id}/escalations:
get:
tags:
- On-call
summary: Fetch escalations using an on-call
description: >
Get all escalations using an on-call schedule across any step of an escalation policy.
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- $ref: '#/components/parameters/_id'
responses:
'200':
description: Get on-call details with layers, shifts, and users
'401':
description: Unauthorized access
## On-call shifts, am I oncall
/oncalls/all-active-on-call-shifts:
get:
tags:
- On-call
summary: Fetch all currently active on-call shifts
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
responses:
'200':
description: List of people on-call with shift details
'401':
description: Unauthorized access
/oncalls/am-i-on-call:
get:
tags:
- On-call
summary: Is a user on-call?
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- in: query
name: id
description: User `_id` in query parameters
required: true
schema:
type: string
responses:
'200':
description: Tells if a user is on-call or not along with extended data on their current active shift
'401':
description: Unauthorized access
/oncalls/upcoming-shifts:
get:
tags:
- On-call
summary: Fetch upcoming shifts from multiple schedules
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- in: query
name: id
description: User `_id` in query parameters
required: true
schema:
type: string
responses:
'200':
description: Tells if a user is on-call or not along with extended data on their current active shift
'401':
description: Unauthorized access
##########
#
# Integrations
#
##########
/integrations/available:
get:
tags:
- Integrations
summary: Fetch available integrations on Spike.sh
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
responses:
'200':
description: List of integrations
'401':
description: Unauthorized access
/integrations:
get:
tags:
- Integrations
summary: Fetch all your integrations
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
responses:
'200':
description: List of integrations
'401':
description: Unauthorized access
/integrations/{token}:
get:
tags:
- Integrations
summary: Fetch an integration
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- in: path
name: token
description: User `_id` in query parameters
required: true
schema:
type: string
responses:
'200':
description: List of integrations
'401':
description: Unauthorized access
/integrations/create:
post:
tags:
- Integrations
summary: Create an integration
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
requestBody:
content:
application/json:
schema:
type: object
properties:
customName:
type: string
description: Integration name
desc:
type: string
slug:
type: string
description: The slug of an integration. You can find more details on `/integrations/available` route
escalation:
type: string
description: Should have escalation `_id`
service:
type: string
description: Should have service `_id`
repeatEscalation:
type: boolean
ackTimeout:
type: number
description: Number of minutes for acknowledge timeout
required:
- customName
- slug
- escalation
- service
responses:
'200':
description: List of integrations
'401':
description: Unauthorized access
/integrations/{token}/archive:
delete:
tags:
- Integrations
summary: Archive an integration
parameters:
- $ref: '#/components/parameters/authHeader'
- $ref: '#/components/parameters/teamHeader'
- in: path
name: token
description: User `_id` in query parameters
required: true
schema:
type: string
responses:
'200':
description: List of integrations
'401':
description: Unauthorized access
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment