> For the complete documentation index, see [llms.txt](https://docs.spike.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spike.sh/spike-api-docs/services.md).

# Services

Create, read and update services. A service is addressed by its numeric `counterId`.

## Creates a service

> Creates a new service in a team. Learn more about \[services]\(<https://docs.spike.sh/services/introduction-to-services-on-spike>)

```json
{"openapi":"3.1.0","info":{"title":"Spike API","version":"1.0.0"},"tags":[{"name":"Services","description":"Create, read and update services. A service is addressed by its numeric `counterId`."}],"servers":[{"url":"https://api.spike.sh","description":"API server"}],"security":[{"ApiKeyAuth":[],"TeamIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your organisation's API key. Create one in the Spike dashboard under Settings > API. Sent on every request as the `x-api-key` header."}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing the problem"},"error":{"type":"string","description":"Error type or code"},"success":{"type":"boolean","description":"Present on the endpoints whose handlers include it (for example the API-key filter and the public on-call routes). Always `false` on an error."},"valid_api":{"type":"boolean","description":"Present on `401`s produced by the session/API-key filter. `false` means the supplied `x-api-key` was not recognised."},"statusCode":{"type":"number","description":"Echo of the HTTP status, present on a few permission errors."}}}}},"paths":{"/services/create":{"post":{"operationId":"postServicesCreate","summary":"Creates a service","description":"Creates a new service in a team. Learn more about [services](https://docs.spike.sh/services/introduction-to-services-on-spike)","tags":["Services"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"desc":{"type":"string"}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"counterId":{"type":"number","description":"Numeric id used in `/services/{counterId}` paths — not the `_id`."},"name":{"type":"string"},"desc":{"type":"string"},"teams":{"type":"array","items":{"type":"string"}},"org":{"type":"string"}}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"x-api-key","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key. Find it in your Spike dashboard under Settings > API."},{"name":"x-team-id","in":"header","required":true,"schema":{"type":"string"},"description":"The team's `_id` — a 24-character hex ObjectId, NOT the short `uid` slug. Read it from `GET /teams/get-all-teams`."}]}}}}
```

## Fetch all services

> Get list of services for a team. Services are scopes for multiple integrations and their incidents.\
> Learn more about \[services]\(<https://docs.spike.sh/services/introduction-to-services-on-spike>).<br>

```json
{"openapi":"3.1.0","info":{"title":"Spike API","version":"1.0.0"},"tags":[{"name":"Services","description":"Create, read and update services. A service is addressed by its numeric `counterId`."}],"servers":[{"url":"https://api.spike.sh","description":"API server"}],"security":[{"ApiKeyAuth":[],"TeamIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your organisation's API key. Create one in the Spike dashboard under Settings > API. Sent on every request as the `x-api-key` header."}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing the problem"},"error":{"type":"string","description":"Error type or code"},"success":{"type":"boolean","description":"Present on the endpoints whose handlers include it (for example the API-key filter and the public on-call routes). Always `false` on an error."},"valid_api":{"type":"boolean","description":"Present on `401`s produced by the session/API-key filter. `false` means the supplied `x-api-key` was not recognised."},"statusCode":{"type":"number","description":"Echo of the HTTP status, present on a few permission errors."}}}}},"paths":{"/services":{"get":{"operationId":"getServices","summary":"Fetch all services","description":"Get list of services for a team. Services are scopes for multiple integrations and their incidents.\nLearn more about [services](https://docs.spike.sh/services/introduction-to-services-on-spike).\n","tags":["Services"],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"totalServices":{"type":"number"},"services":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"counterId":{"type":"number","description":"Numeric id used in `/services/{counterId}` paths — not the `_id`."},"name":{"type":"string"},"desc":{"type":"string"},"teams":{"type":"array","items":{"type":"string"}},"org":{"type":"string"}}}},"pagination":{"type":"object","description":"Pagination envelope produced by `lib/pagination.js`.","properties":{"currentPage":{"type":"number"},"totalPages":{"type":"number"},"total":{"type":"number"},"perPage":{"type":"number"},"skip":{"type":"number"},"pages":{"type":"array","items":{"type":"number"}},"showingFrom":{"type":"number"},"showingTill":{"type":"number"}}}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"x-api-key","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key. Find it in your Spike dashboard under Settings > API."},{"name":"x-team-id","in":"header","required":true,"schema":{"type":"string"},"description":"The team's `_id` — a 24-character hex ObjectId, NOT the short `uid` slug. Read it from `GET /teams/get-all-teams`."}]}}}}
```

## Fetch incidents for a service

> Get a list of incidents for a specific service.\
> Returns a list of incidents for a service.<br>

```json
{"openapi":"3.1.0","info":{"title":"Spike API","version":"1.0.0"},"tags":[{"name":"Services","description":"Create, read and update services. A service is addressed by its numeric `counterId`."}],"servers":[{"url":"https://api.spike.sh","description":"API server"}],"security":[{"ApiKeyAuth":[],"TeamIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your organisation's API key. Create one in the Spike dashboard under Settings > API. Sent on every request as the `x-api-key` header."}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing the problem"},"error":{"type":"string","description":"Error type or code"},"success":{"type":"boolean","description":"Present on the endpoints whose handlers include it (for example the API-key filter and the public on-call routes). Always `false` on an error."},"valid_api":{"type":"boolean","description":"Present on `401`s produced by the session/API-key filter. `false` means the supplied `x-api-key` was not recognised."},"statusCode":{"type":"number","description":"Echo of the HTTP status, present on a few permission errors."}}}}},"paths":{"/services/{counterId}/incidents":{"get":{"operationId":"getServicesByCounterIdIncidents","summary":"Fetch incidents for a service","description":"Get a list of incidents for a specific service.\nReturns a list of incidents for a service.\n","tags":["Services"],"parameters":[{"name":"x-api-key","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key. Find it in your Spike dashboard under Settings > API."},{"name":"x-team-id","in":"header","required":true,"schema":{"type":"string"},"description":"The team's `_id` — a 24-character hex ObjectId, NOT the short `uid` slug. Read it from `GET /teams/get-all-teams`."},{"name":"counterId","in":"path","required":true,"schema":{"type":"string"},"description":"counterId parameter"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"service":{"type":"object","properties":{"_id":{"type":"string"},"counterId":{"type":"number","description":"Numeric id used in `/services/{counterId}` paths — not the `_id`."},"name":{"type":"string"},"desc":{"type":"string"},"teams":{"type":"array","items":{"type":"string"}},"org":{"type":"string"}}},"incidents":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"counterId":{"type":"string","description":"Human-facing id, `<teamUid>-<counter>`. Accepted anywhere an incident id is taken."},"message":{"type":"string"},"status":{"type":"string","enum":["NACK","ACK","RES"],"description":"Lifecycle state of the incident. `NACK` = triggered (nobody has acknowledged it yet). `ACK` = acknowledged (a responder is on it). `RES` = resolved. These three literals are the only values the API ever returns or accepts — there is no `triggered`/`acknowledged`/`resolved` spelling."},"priority":{"type":"string","enum":["p1","p2","p3","p4","p5"]},"severity":{"type":"string","enum":["sev1","sev2","sev3"]},"counter":{"type":"number"},"org":{"type":"string"},"teams":{"type":"array","items":{"type":"string"}},"integration":{"type":"object"},"service":{"type":"object"},"escalation":{"type":"object"},"responders":{"type":"array","items":{"type":"object"}},"createdAt":{"type":"string","format":"date-time"},"NACK_at":{"type":"string","format":"date-time"}}}},"openIncidentsCountForService":{"type":"number"},"currentPage":{"type":"number"},"perPage":{"type":"number"},"total":{"type":"number"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Fetch integrations of a service

> Get a list of integrations for a specific service.\
> Includes all the integrations for a service with their details and webhook.<br>

```json
{"openapi":"3.1.0","info":{"title":"Spike API","version":"1.0.0"},"tags":[{"name":"Services","description":"Create, read and update services. A service is addressed by its numeric `counterId`."}],"servers":[{"url":"https://api.spike.sh","description":"API server"}],"security":[{"ApiKeyAuth":[],"TeamIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your organisation's API key. Create one in the Spike dashboard under Settings > API. Sent on every request as the `x-api-key` header."}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing the problem"},"error":{"type":"string","description":"Error type or code"},"success":{"type":"boolean","description":"Present on the endpoints whose handlers include it (for example the API-key filter and the public on-call routes). Always `false` on an error."},"valid_api":{"type":"boolean","description":"Present on `401`s produced by the session/API-key filter. `false` means the supplied `x-api-key` was not recognised."},"statusCode":{"type":"number","description":"Echo of the HTTP status, present on a few permission errors."}}}}},"paths":{"/services/{counterId}/integrations":{"get":{"operationId":"getServicesByCounterIdIntegrations","summary":"Fetch integrations of a service","description":"Get a list of integrations for a specific service.\nIncludes all the integrations for a service with their details and webhook.\n","tags":["Services"],"parameters":[{"name":"x-api-key","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key. Find it in your Spike dashboard under Settings > API."},{"name":"x-team-id","in":"header","required":true,"schema":{"type":"string"},"description":"The team's `_id` — a 24-character hex ObjectId, NOT the short `uid` slug. Read it from `GET /teams/get-all-teams`."},{"name":"counterId","in":"path","required":true,"schema":{"type":"string"},"description":"counterId parameter"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"integrations":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"token":{"type":"string","description":"The integration reference used by `POST /incidents/create` (as `integrationWebhook`) and by `GET|DELETE /integrations/{token}`. Never use the `_id`."},"webhookUrl":{"type":"string"},"service":{"type":"string"},"escalation":{"type":"string"},"teams":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"}}}},"service":{"type":"object","properties":{"_id":{"type":"string"},"counterId":{"type":"number","description":"Numeric id used in `/services/{counterId}` paths — not the `_id`."},"name":{"type":"string"},"desc":{"type":"string"},"teams":{"type":"array","items":{"type":"string"}},"org":{"type":"string"}}},"openIncidentsCountForService":{"type":"number"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Fetch service details with incidents

> Get details of a service with it's incidents. Services are scopes for multiple integrations and their incidents.\
> This route also returns the list of incidents for a service.<br>

```json
{"openapi":"3.1.0","info":{"title":"Spike API","version":"1.0.0"},"tags":[{"name":"Services","description":"Create, read and update services. A service is addressed by its numeric `counterId`."}],"servers":[{"url":"https://api.spike.sh","description":"API server"}],"security":[{"ApiKeyAuth":[],"TeamIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your organisation's API key. Create one in the Spike dashboard under Settings > API. Sent on every request as the `x-api-key` header."}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing the problem"},"error":{"type":"string","description":"Error type or code"},"success":{"type":"boolean","description":"Present on the endpoints whose handlers include it (for example the API-key filter and the public on-call routes). Always `false` on an error."},"valid_api":{"type":"boolean","description":"Present on `401`s produced by the session/API-key filter. `false` means the supplied `x-api-key` was not recognised."},"statusCode":{"type":"number","description":"Echo of the HTTP status, present on a few permission errors."}}}}},"paths":{"/services/{counterId}":{"get":{"operationId":"getServicesByCounterId","summary":"Fetch service details with incidents","description":"Get details of a service with it's incidents. Services are scopes for multiple integrations and their incidents.\nThis route also returns the list of incidents for a service.\n","tags":["Services"],"parameters":[{"name":"x-api-key","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key. Find it in your Spike dashboard under Settings > API."},{"name":"x-team-id","in":"header","required":true,"schema":{"type":"string"},"description":"The team's `_id` — a 24-character hex ObjectId, NOT the short `uid` slug. Read it from `GET /teams/get-all-teams`."},{"name":"counterId","in":"path","required":true,"schema":{"type":"string"},"description":"counterId parameter"}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"service":{"type":"object","properties":{"_id":{"type":"string"},"counterId":{"type":"number","description":"Numeric id used in `/services/{counterId}` paths — not the `_id`."},"name":{"type":"string"},"desc":{"type":"string"},"teams":{"type":"array","items":{"type":"string"}},"org":{"type":"string"}}},"org":{"type":"object"},"openIncidentsCountForService":{"type":"number"},"incidents":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"counterId":{"type":"string","description":"Human-facing id, `<teamUid>-<counter>`. Accepted anywhere an incident id is taken."},"message":{"type":"string"},"status":{"type":"string","enum":["NACK","ACK","RES"],"description":"Lifecycle state of the incident. `NACK` = triggered (nobody has acknowledged it yet). `ACK` = acknowledged (a responder is on it). `RES` = resolved. These three literals are the only values the API ever returns or accepts — there is no `triggered`/`acknowledged`/`resolved` spelling."},"priority":{"type":"string","enum":["p1","p2","p3","p4","p5"]},"severity":{"type":"string","enum":["sev1","sev2","sev3"]},"counter":{"type":"number"},"org":{"type":"string"},"teams":{"type":"array","items":{"type":"string"}},"integration":{"type":"object"},"service":{"type":"object"},"escalation":{"type":"object"},"responders":{"type":"array","items":{"type":"object"}},"createdAt":{"type":"string","format":"date-time"},"NACK_at":{"type":"string","format":"date-time"}}}},"badgeURL":{"type":"string"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## GET /services/affected

> Fetch currently affected services

```json
{"openapi":"3.1.0","info":{"title":"Spike API","version":"1.0.0"},"tags":[{"name":"Services","description":"Create, read and update services. A service is addressed by its numeric `counterId`."}],"servers":[{"url":"https://api.spike.sh","description":"API server"}],"security":[{"ApiKeyAuth":[],"TeamIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your organisation's API key. Create one in the Spike dashboard under Settings > API. Sent on every request as the `x-api-key` header."}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing the problem"},"error":{"type":"string","description":"Error type or code"},"success":{"type":"boolean","description":"Present on the endpoints whose handlers include it (for example the API-key filter and the public on-call routes). Always `false` on an error."},"valid_api":{"type":"boolean","description":"Present on `401`s produced by the session/API-key filter. `false` means the supplied `x-api-key` was not recognised."},"statusCode":{"type":"number","description":"Echo of the HTTP status, present on a few permission errors."}}}}},"paths":{"/services/affected":{"get":{"operationId":"getServicesAffected","summary":"Fetch currently affected services","tags":["Services"],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"affectedServices":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"counterId":{"type":"number","description":"Numeric id used in `/services/{counterId}` paths — not the `_id`."},"name":{"type":"string"},"desc":{"type":"string"},"teams":{"type":"array","items":{"type":"string"}},"org":{"type":"string"}}}}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"parameters":[{"name":"x-api-key","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key. Find it in your Spike dashboard under Settings > API."},{"name":"x-team-id","in":"header","required":true,"schema":{"type":"string"},"description":"The team's `_id` — a 24-character hex ObjectId, NOT the short `uid` slug. Read it from `GET /teams/get-all-teams`."}]}}}}
```

## Updates a service

> Update your service name and description only

```json
{"openapi":"3.1.0","info":{"title":"Spike API","version":"1.0.0"},"tags":[{"name":"Services","description":"Create, read and update services. A service is addressed by its numeric `counterId`."}],"servers":[{"url":"https://api.spike.sh","description":"API server"}],"security":[{"ApiKeyAuth":[],"TeamIdHeader":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Your organisation's API key. Create one in the Spike dashboard under Settings > API. Sent on every request as the `x-api-key` header."}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing the problem"},"error":{"type":"string","description":"Error type or code"},"success":{"type":"boolean","description":"Present on the endpoints whose handlers include it (for example the API-key filter and the public on-call routes). Always `false` on an error."},"valid_api":{"type":"boolean","description":"Present on `401`s produced by the session/API-key filter. `false` means the supplied `x-api-key` was not recognised."},"statusCode":{"type":"number","description":"Echo of the HTTP status, present on a few permission errors."}}}}},"paths":{"/services/{counterId}/update":{"put":{"operationId":"putServicesByCounterIdUpdate","summary":"Updates a service","description":"Update your service name and description only","tags":["Services"],"parameters":[{"name":"x-api-key","in":"header","required":true,"schema":{"type":"string"},"description":"Your API key. Find it in your Spike dashboard under Settings > API."},{"name":"x-team-id","in":"header","required":true,"schema":{"type":"string"},"description":"The team's `_id` — a 24-character hex ObjectId, NOT the short `uid` slug. Read it from `GET /teams/get-all-teams`."},{"name":"counterId","in":"path","required":true,"schema":{"type":"string"},"description":"counterId parameter"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"desc":{"type":"string"}}}}}},"responses":{"200":{"description":"The updated service. The path takes the numeric `counterId`, never the `_id`.","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"counterId":{"type":"number","description":"Numeric id used in `/services/{counterId}` paths — not the `_id`."},"name":{"type":"string"},"desc":{"type":"string"},"teams":{"type":"array","items":{"type":"string"}},"org":{"type":"string"}}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```
