> This page is for Developers.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emnify.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emnify.com/_mcp/server.

# Deploy custom event

POST https://cdn.emnify.net/api/v1/event/custom/configuration
Content-Type: application/json

Deploys a custom event with the specified configuration.
A custom event inherits `supported_action_ids` from its template's current state, so it changes if the template does.


Reference: https://docs.emnify.com/developers/api/custom-events/create-custom-event-instance

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects a CustomEventCreateDto.

- `organisation` (WithIdInputDto, required)
- `template` (WithIdInputDto, required)
- `configuration_properties` (list of ConfigurationInputPropertiesDto, required)
- `name` (string, required)

## Response

### 201

- `organisation` (WithIdInputDto, required)
- `template` (WithIdInputDto, required)
- `configuration_properties` (list of ConfigurationInputPropertiesDto, required)
- `name` (string, required)
- `id` (string, required)
- `supportedTargetingParameters` (list of string, required)
- `supportedActions` (list of string, required)
- `supported_action_ids` (list of string, optional) — Action IDs this event declares support for, used to decide which actions are offered for it. - Field absent: no restriction is declared, so every action whose `required_event_output_parameters` the event emits is offered. - Empty array: a declaration in its own right, so no actions are offered. - Non-empty list: intersected with the parameter check, so a listed action is offered only if the event also emits every parameter that action requires. The list can only narrow what's offered, never widen it.

## Errors

### 400 Bad Request Error

The request body is invalid, or the request breaks one of the API's limits or rules. For example, the organization already has the maximum of 50 custom events, or a configuration property is invalid.

- `status_code` (integer, required) — HTTP status code of the response
- `message` (ErrorResponseMessage, required) — A human-readable reason for the error. Request-body validation failures list one entry per violated constraint.

### 403 Forbidden Error

You don't have permission to create a custom event in the given organization.

- `status_code` (integer, required) — HTTP status code of the response
- `message` (ErrorResponseMessage, required) — A human-readable reason for the error. Request-body validation failures list one entry per violated constraint.

### 404 Not Found Error

The custom event template doesn't exist, is turned off, or isn't available to your organization.

- `status_code` (integer, required) — HTTP status code of the response
- `message` (ErrorResponseMessage, required) — A human-readable reason for the error. Request-body validation failures list one entry per violated constraint.

## Types

### WithIdInputDto

- `id` (double, required)

### ConfigurationInputPropertiesDto

- `property` (string, required)
- `value` (string, required)
- `value_array` (list of string, required)

### ErrorResponseMessage

A human-readable reason for the error. Request-body validation failures list one entry per violated constraint.

## Examples

**Request**

```json
{
  "organisation": {
    "id": 200
  },
  "template": {
    "id": 1
  },
  "configuration_properties": [
    {
      "property": "count_of_pdp",
      "value": "10",
      "value_array": [
        "string"
      ]
    },
    {
      "property": "duration",
      "value": "1w",
      "value_array": [
        "string"
      ]
    }
  ],
  "name": "PDP Threshold 50 Over One Week"
}
```

**Response**

```json
{
  "organisation": {
    "id": 200
  },
  "template": {
    "id": 1
  },
  "configuration_properties": [
    {
      "property": "count_of_pdp",
      "value": "10",
      "value_array": [
        "string"
      ]
    },
    {
      "property": "duration",
      "value": "1w",
      "value_array": [
        "string"
      ]
    }
  ],
  "name": "PDP Threshold 50 Over One Week",
  "id": "2",
  "supportedTargetingParameters": [
    "string"
  ],
  "supportedActions": [
    "string"
  ],
  "supported_action_ids": [
    "system-send_notification_with_email"
  ],
  "supported_actions": [
    {
      "configuration_properties": [
        {
          "default": null,
          "description": "List of email addresses to notify",
          "property": "recipients",
          "required": true,
          "type": "email[]"
        }
      ],
      "description": "Send notification via email",
      "id": "system-send_notification_with_email",
      "name": "Send notification via email",
      "required_event_output_parameters": [
        {
          "description": "Standard description of the event",
          "parameter": "event_description",
          "type": "string"
        }
      ],
      "status": "active",
      "translation_key_description": "Send notification with email D",
      "translation_key_name": "Send notification with email N",
      "type": "system"
    }
  ],
  "supported_targeting_parameters": [
    {
      "description": "Service Policy",
      "parameter": "service_policy",
      "type": "number[]"
    },
    {
      "description": "Endpoint Tag",
      "parameter": "endpoint_tag",
      "type": "string[]"
    }
  ]
}
```

**SDK Code**

```python Deployed
import requests

url = "https://cdn.emnify.net/api/v1/event/custom/configuration"

payload = {
    "organisation": { "id": 200 },
    "template": { "id": 1 },
    "configuration_properties": [
        {
            "property": "count_of_pdp",
            "value": "10",
            "value_array": ["string"]
        },
        {
            "property": "duration",
            "value": "1w",
            "value_array": ["string"]
        }
    ],
    "name": "PDP Threshold 50 Over One Week"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Deployed
const url = 'https://cdn.emnify.net/api/v1/event/custom/configuration';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"organisation":{"id":200},"template":{"id":1},"configuration_properties":[{"property":"count_of_pdp","value":"10","value_array":["string"]},{"property":"duration","value":"1w","value_array":["string"]}],"name":"PDP Threshold 50 Over One Week"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Deployed
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://cdn.emnify.net/api/v1/event/custom/configuration"

	payload := strings.NewReader("{\n  \"organisation\": {\n    \"id\": 200\n  },\n  \"template\": {\n    \"id\": 1\n  },\n  \"configuration_properties\": [\n    {\n      \"property\": \"count_of_pdp\",\n      \"value\": \"10\",\n      \"value_array\": [\n        \"string\"\n      ]\n    },\n    {\n      \"property\": \"duration\",\n      \"value\": \"1w\",\n      \"value_array\": [\n        \"string\"\n      ]\n    }\n  ],\n  \"name\": \"PDP Threshold 50 Over One Week\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Deployed
require 'uri'
require 'net/http'

url = URI("https://cdn.emnify.net/api/v1/event/custom/configuration")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"organisation\": {\n    \"id\": 200\n  },\n  \"template\": {\n    \"id\": 1\n  },\n  \"configuration_properties\": [\n    {\n      \"property\": \"count_of_pdp\",\n      \"value\": \"10\",\n      \"value_array\": [\n        \"string\"\n      ]\n    },\n    {\n      \"property\": \"duration\",\n      \"value\": \"1w\",\n      \"value_array\": [\n        \"string\"\n      ]\n    }\n  ],\n  \"name\": \"PDP Threshold 50 Over One Week\"\n}"

response = http.request(request)
puts response.read_body
```

```java Deployed
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://cdn.emnify.net/api/v1/event/custom/configuration")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"organisation\": {\n    \"id\": 200\n  },\n  \"template\": {\n    \"id\": 1\n  },\n  \"configuration_properties\": [\n    {\n      \"property\": \"count_of_pdp\",\n      \"value\": \"10\",\n      \"value_array\": [\n        \"string\"\n      ]\n    },\n    {\n      \"property\": \"duration\",\n      \"value\": \"1w\",\n      \"value_array\": [\n        \"string\"\n      ]\n    }\n  ],\n  \"name\": \"PDP Threshold 50 Over One Week\"\n}")
  .asString();
```

```php Deployed
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://cdn.emnify.net/api/v1/event/custom/configuration', [
  'body' => '{
  "organisation": {
    "id": 200
  },
  "template": {
    "id": 1
  },
  "configuration_properties": [
    {
      "property": "count_of_pdp",
      "value": "10",
      "value_array": [
        "string"
      ]
    },
    {
      "property": "duration",
      "value": "1w",
      "value_array": [
        "string"
      ]
    }
  ],
  "name": "PDP Threshold 50 Over One Week"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Deployed
using RestSharp;

var client = new RestClient("https://cdn.emnify.net/api/v1/event/custom/configuration");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"organisation\": {\n    \"id\": 200\n  },\n  \"template\": {\n    \"id\": 1\n  },\n  \"configuration_properties\": [\n    {\n      \"property\": \"count_of_pdp\",\n      \"value\": \"10\",\n      \"value_array\": [\n        \"string\"\n      ]\n    },\n    {\n      \"property\": \"duration\",\n      \"value\": \"1w\",\n      \"value_array\": [\n        \"string\"\n      ]\n    }\n  ],\n  \"name\": \"PDP Threshold 50 Over One Week\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Deployed
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "organisation": ["id": 200],
  "template": ["id": 1],
  "configuration_properties": [
    [
      "property": "count_of_pdp",
      "value": "10",
      "value_array": ["string"]
    ],
    [
      "property": "duration",
      "value": "1w",
      "value_array": ["string"]
    ]
  ],
  "name": "PDP Threshold 50 Over One Week"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://cdn.emnify.net/api/v1/event/custom/configuration")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```