---
title: "Subscribe"
method: POST
path: "/events/subscription"
tags: ["Notification Subscription Service"]
---

# Subscribe

`POST /events/subscription`

Create a notification for your resources
  > **Note:** This service is deprecated. Use the 
  [Notification Center Service](https://spec.dev.spot.io/#tag/Notification-Center-Service).

## Query parameters

- `accountId` string

## Request body

- union
  - object
    - `subscription` object, required — Object defining the subscription parameters
      - `resourceId` string, required — Spot Resource ID (Elastigroup ID, Ocean ID or Stateful Node ID)
      - `protocol` 'aws-sns' | 'email' | 'email-json' | 'web', required — The protocol to send the notification. The following values are deprecated: http https You can use the generic web protocol instead. aws-sns is only supported with AWS provider
      - `endpoint` string, required — The endpoint the notification will be sent to. url in case of http/https/web, email address in case of email/email-json and sns-topic-arn in case of aws-sns. For example: YOUR@EMAIL.COM or https://YOUR_ENDPOINT.COM or SNS_TOPIC_ARN
      - `eventType` 'AWS_EC2_INSTANCE_TERMINATE' | 'AWS_EC2_INSTANCE_TERMINATED' | 'AWS_EC2_INSTANCE_LAUNCH' | 'AWS_EC2_INSTANCE_READY_SIGNAL_TIMEOUT' | 'SIGNAL_TIMEOUT_SHUTDOWN_SCRIPT' | 'AWS_EC2_CANT_SPIN_OD' | 'AWS_EC2_INSTANCE_UNHEALTHY_IN_ELB' | 'GROUP_ROLL_FAILED' | 'GROUP_ROLL_FINISHED' | 'CANT_SCALE_UP_GROUP_MAX_CAPACITY' | 'GROUP_UPDATED' | 'AWS_EMR_PROVISION_TIMEOUT' | 'GROUP_BEANSTALK_INIT_READY' | 'AZURE_VM_TERMINATED' | 'AZURE_VM_TERMINATE' | 'AWS_EC2_MANAGED_INSTANCE_PAUSING' | 'AWS_EC2_MANAGED_INSTANCE_RESUMING' | 'AWS_EC2_MANAGED_INSTANCE_RECYCLING' | 'AWS_EC2_MANAGED_INSTANCE_DELETING', required — The event to send the notification when triggered.
      - `eventFormat` object — The format of the notification content (JSON Format: Key + Value). The keys can be renamed.
        - `event` '%event%' — Allow to get name of event that happened
        - `resourceId` '%resource-id%' — Allow to get ID of resource where event happened
        - `resourceName` '%resource-name%' — Allow to get the name of resource (related to ID)
        - `instanceId` '%instance-id%' — Allow to get the instance ID which related to the event
        - `myCustomKey` string — Allow to use custom text in messages
  - object
    - `subscription` object, required — Object defining the subscription parameters
      - `resourceId` string, required — Spot Resource ID (Elastigroup ID, Ocean ID or Stateful Node ID)
      - `protocol` 'aws-sns' | 'email' | 'email-json' | 'web', required — The protocol to send the notification. The following values are deprecated: http https You can use the generic web protocol instead. aws-sns is only supported with AWS provider
      - `endpoint` string, required — The endpoint the notification will be sent to. url in case of http/https/web, email address in case of email/email-json and sns-topic-arn in case of aws-sns. For example: YOUR@EMAIL.COM or https://YOUR_ENDPOINT.COM or SNS_TOPIC_ARN
      - `eventType` 'AWS_EC2_INSTANCE_TERMINATE' | 'AWS_EC2_INSTANCE_TERMINATED' | 'AWS_EC2_INSTANCE_LAUNCH' | 'AWS_EC2_INSTANCE_READY_SIGNAL_TIMEOUT' | 'SIGNAL_TIMEOUT_SHUTDOWN_SCRIPT' | 'AWS_EC2_CANT_SPIN_OD' | 'AWS_EC2_INSTANCE_UNHEALTHY_IN_ELB' | 'GROUP_ROLL_FAILED' | 'GROUP_ROLL_FINISHED' | 'CANT_SCALE_UP_GROUP_MAX_CAPACITY' | 'GROUP_UPDATED' | 'AWS_EMR_PROVISION_TIMEOUT' | 'GROUP_BEANSTALK_INIT_READY' | 'AZURE_VM_TERMINATED' | 'AZURE_VM_TERMINATE' | 'AWS_EC2_MANAGED_INSTANCE_PAUSING' | 'AWS_EC2_MANAGED_INSTANCE_RESUMING' | 'AWS_EC2_MANAGED_INSTANCE_RECYCLING' | 'AWS_EC2_MANAGED_INSTANCE_DELETING' | 'CLUSTER_ROLL_FINISHED' | 'CLUSTER_ROLL_FAILED' | 'OCEAN_CANT_SCALE_UP_MAX_RESOURCES' | 'OCEAN_LAUNCH_SPEC_CANT_SCALE_UP_MAX_INSTANCES' | 'OCEAN_K8S_NODE_REMOVED', required — The event to send the notification when triggered. \ The following event types are relevant for Ocean events only: \ CLUSTER_ROLL_FINISHED, \ CLUSTER_ROLL_FAILED, \ OCEAN_CANT_SCALE_UP_MAX_RESOURCES, \ OCEAN_LAUNCH_SPEC_CANT_SCALE_UP_MAX_INSTANCES, \ OCEAN_K8S_NODE_REMOVED
      - `eventFormat` object — The format of the notification content (JSON Format: Key + Value). The keys can be renamed.
        - `event` '%event%' — Allow to get name of event that happened
        - `resourceId` '%resource-id%' — Allow to get ID of resource where event happened
        - `resourceName` '%resource-name%' — Allow to get the name of resource (related to ID)
        - `instanceId` '%instance-id%' — Allow to get the instance ID which related to the event
        - `launchSpecId` '%launchSpec-id%' — Allow to get the Virtual Node Group ID which related to the event
        - `launchSpecName` '%launchSpec-name%' — Allow to get the Virtual Node Group name which related to the event (relevant only for OCEAN_K8S_NODE_REMOVED)
        - `nodeName` '%node-name%' — Allow to get the node name which related to the event (relevant only for OCEAN_K8S_NODE_REMOVED)
        - `runningPodsOnNode` '%running-pods-on-node%' — Allow to get the running pods on the node which related to the event (relevant only for OCEAN_K8S_NODE_REMOVED)
        - `myCustomKey` string — Allow to use custom text in messages

## Other responses

- `200` — unresolved $ref
- `400` — Bad Request

---

[API](https://skmtc.net/spot/apis/spot-by-flexera-api.md) · [All operations](https://skmtc.net/spot/apis/spot-by-flexera-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/spot/spot-by-flexera-api/revisions/72813baf8d47/schema)
