---
agentTools:
  projectIndex: https://docs.iotcreators.com/llms.txt
---

# Create subscription

[block:callout]
{
  "type": "danger",
  "body": "This function requires that an application URL is registered for the API user.",
  "title": "Application URL required"
}
[/block]

Creates a device subscription for the event types **Lifecycle Events** and **Resource Events**.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "IoT Creators SCS API",
    "version": "2.2"
  },
  "servers": [
    {
      "url": "https://api.scs.iot.telekom.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/m2m/subscriptions?type={type}": {
      "post": {
        "summary": "Create subscription",
        "description": "",
        "operationId": "register-subscription-1",
        "parameters": [
          {
            "name": "type",
            "in": "path",
            "description": "Use *resources* or *lifecycleEvents*",
            "schema": {
              "type": "string",
              "default": "resources"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subscriptionType": {
                    "type": "string",
                    "description": "Use either *resources* or *lifecycleEvents*",
                    "default": "resources"
                  },
                  "deletionPolicy": {
                    "type": "integer",
                    "description": "In case of unsuccessful transmission to final destination after max number of retrials: 0 – Data removed from destination queue  1 – Data persisted (DLQ) until client application is back and Impact system detects its presence.",
                    "default": 0,
                    "format": "int32"
                  },
                  "resources": {
                    "type": "array",
                    "description": "[{\"resourcePath\":\"uplinkMsg/0/data\"},{\"resourcePath\":\"downlinkMsg/0/data\"}]",
                    "items": {
                      "properties": {
                        "resourcePath": {
                          "type": "string",
                          "description": "The path of the resource data you want to subscribe to"
                        }
                      },
                      "type": "object"
                    }
                  },
                  "criteria": {
                    "type": "object",
                    "description": "Array of device serial imeis: {\"serialNumbers\":[\"IMEI:<device-imei>\", \"IMEI:<device-imei>\"]}",
                    "properties": {
                      "serialNumbers": {
                        "type": "array",
                        "description": "Serialnumbers",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"subscriptionId\": \"5dd845ce-c9f2-4c89-8ced-869494a450bc\",\n    \"msg\": \"Success\",\n    \"code\": 1000\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "subscriptionId": {
                      "type": "string",
                      "example": "5dd845ce-c9f2-4c89-8ced-869494a450bc"
                    },
                    "msg": {
                      "type": "string",
                      "example": "Success"
                    },
                    "code": {
                      "type": "integer",
                      "example": 1000,
                      "default": 0
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": ""
                  }
                }
              }
            }
          },
          "403": {
            "description": "403",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": ""
                  }
                }
              }
            }
          },
          "404": {
            "description": "404",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": ""
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "63a06c49e8d3b10025e2aaa7:63a06c49e8d3b10025e2aab0"
}
```