---
updatedAt: 2025-09-24T21:09:36.000Z
agentTools:
  projectIndex: https://developers.postscript.io/llms.txt
---

# Create Custom Event

Send a Custom Event to use in Flows

Custom Events can be used as [Flow Triggers](https://help.postscript.io/hc/en-us/articles/6402078919323-Guide-to-Automation-Flow-Triggers-and-Trigger-Filters) or in [Flow Wait for Event Split Branching Actions](https://help.postscript.io/hc/en-us/articles/5383040985371-Guide-to-Wait-for-Event-Branching-in-Campaign-Flows).

### Type & Display Name

Events sent through the API will display the `type` prefixed with the partner/shop name in Flows. For example, if sending an event called `"OrderPlaced"`, the event will display as as `"[Your Partner/Shop Name] - OrderPlaced"` to distinguish it from other events of a similar type.

### Subscriber Identifiers

Events can include an identifier to tie the record to a subscriber (`subscriber_id`, `phone`, and/or `email`). API requests can be sent with multiple identifiers.

If provided, Postscript will attempt to reconcile the provided identifier(s) to a single Subscriber using the following steps:

1. Attempt to match Subscriber using`subscriber_id`(unique across platform)
2. If `subscriber_id` is not provided or no Subscriber has yet been matched, attempt to match using `phone_number` (unique per-Shop)
3. If `subscriber_id` and `phone` are not provided or no Subscriber has yet been matched, attempt to match using `email` (if multiple Subscribers exist, prioritize the most recent opted-in Subscriber)

Matching is done asynchronously. If no Subscriber is found for the given identifier(s), the event definition will still be captured and made available in Flows.

*Note: This recent update now means you may populate Postscript with your custom events prior to Subscribers triggering them.*

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "partner-api",
    "version": "2.0"
  },
  "servers": [
    {
      "url": "https://api.postscript.io"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "x-bearer-format": "bearer"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/api/v2/events": {
      "post": {
        "summary": "Create Custom Event",
        "description": "Send a Custom Event to use in Flows",
        "operationId": "create-custom-event",
        "parameters": [
          {
            "name": "X-Postscript-Shop-Token",
            "in": "header",
            "description": "Shop API Token. **Required for partners**. This header should be used *only* by partners. Shops should include their API token in the *Authorization* header.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "description": "The type of event that you are creating. This is the name of the event that will show in the Postscript application. **Note:** when creating this event, we will *automatically* prefix your partner/shop name in front of the event. For example, if sending an event called \"OrderPlaced\", we'll show it in our UI as \"[Your Partner/Shop Name] - OrderPlaced\" to distinguish it from others of a similar name. We accept the follow characters in the value field: lowercase letters (a-z), uppercase letters (A-Z), digits (0-9), and underscores (_)."
                  },
                  "subscriber_id": {
                    "type": "string",
                    "description": "The ID of the subscriber that you are creating the event for."
                  },
                  "phone": {
                    "type": "string",
                    "description": "The phone number of the subscriber that you are creating the event for. E.164 format is recommended, but other formats will be accepted."
                  },
                  "email": {
                    "type": "string",
                    "description": "The email of the subscriber that you are creating the event for."
                  },
                  "occurred_at": {
                    "type": "string",
                    "description": "When the event occurred. This parameter is optional but allows you to set the exact time that the event occurred on your system. If it is not sent to us, we will just use the current time when we receive it. The following UTC time format is supported: %Y-%m-%d %H:%M:%S.%f",
                    "format": "date"
                  },
                  "properties": {
                    "type": "object",
                    "description": "These are the properties of the event. These properties will be exposed in the Postscript platform for things like filtering and merge tags to merchants.",
                    "properties": {
                      "key": {
                        "type": "string",
                        "description": "Properties can be key:value pairs. We will attempt to choose the appropriate data type for the value depending on what you send us. We currently accept strings, booleans, integers, floats, and datetime strings.",
                        "default": "value"
                      }
                    }
                  },
                  "external_id": {
                    "type": "string",
                    "description": "The unique id of the event on your system. This is an optional field. If a value is not provided, we will create a default id ourselves based on time of event received."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "202",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n\t\"event_ids\": [\"1234-abcd-5678\"]\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "event_ids": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "example": "1234-abcd-5678"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {}
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```