---
title: "Create a Cache Variable for a Global Event Orchestration"
method: POST
path: "/event_orchestrations/{id}/cache_variables"
tags: ["Event Orchestrations"]
---

# Create a Cache Variable for a Global Event Orchestration

`POST /event_orchestrations/{id}/cache_variables`

Create a Cache Variable for a Global Event Orchestration.

Cache Variables allow you to store event data on an Event Orchestration, which can then be used in Event Orchestration rules as part of conditions or actions.

For more information see the [API Concepts Document](../../api-reference/a47605517c19a-api-concepts#event-orchestrations)

Scoped OAuth requires: `event_orchestrations.write`

## Path parameters

- `id` string, required

## Headers

- `Accept` string, required
- `Content-Type` 'application/json', required

## Request body

- object
  - `cache_variable` union, required
    - OrchestrationCacheVariableRecentValue
      - `id` string
      - `name` string, required — The name of the Cache Variable
      - `disabled` boolean — Indicates whether the Cache Variable is disabled and would therefore not be evaluated.
      - `created_at` string, date-time — The date/time the object was created.
      - `created_by` object — Reference to the user that created the object.
        - `id` string
        - `type` string — A string that determines the schema of the object. This must be the standard name for the entity, suffixed by `_reference` if the object is a reference.
        - `self` string, url — The API show URL at which the object is accessible
      - `updated_at` string, date-time — The date/time the object was last updated.
      - `updated_by` object — Reference to the user that last updated the object.
        - `id` string
        - `type` string — A string that determines the schema of the object. This must be the standard name for the entity, suffixed by `_reference` if the object is a reference.
        - `self` string, url — The API show URL at which the object is accessible
      - `configuration` object, required
        - `type` 'recent_value' — Cache Variable will be set to the most recent value seen, based on the source event field and the extraction regex specified
        - `source` string — The path to the event field where the regex will be applied to extract a value.
        - `regex` string — A RE2 regular expression. If it contains one or more capture groups, their values will be extracted and appended together. If it contains no capture groups, the whole match is used.
      - `conditions` object[] — Each of these conditions is evaluated to check if an event matches this rule. The rule is considered a match if **any** of these conditions match.
        - `expression` string — A PCL condition string. Note: The `trigger_count` and `resetting_trigger_count` operators are unsupported for Cache Variables
    - OrchestrationCacheVariableTriggerEventCount — unresolved $ref
    - OrchestrationCacheVariableExternalData — unresolved $ref

## Response `200`

The created Cache Variable for this Event Orchestration.

- object
  - `cache_variable` union
    - OrchestrationCacheVariableRecentValue
      - `id` string
      - `name` string, required — The name of the Cache Variable
      - `disabled` boolean — Indicates whether the Cache Variable is disabled and would therefore not be evaluated.
      - `created_at` string, date-time — The date/time the object was created.
      - `created_by` object — Reference to the user that created the object.
        - `id` string
        - `type` string — A string that determines the schema of the object. This must be the standard name for the entity, suffixed by `_reference` if the object is a reference.
        - `self` string, url — The API show URL at which the object is accessible
      - `updated_at` string, date-time — The date/time the object was last updated.
      - `updated_by` object — Reference to the user that last updated the object.
        - `id` string
        - `type` string — A string that determines the schema of the object. This must be the standard name for the entity, suffixed by `_reference` if the object is a reference.
        - `self` string, url — The API show URL at which the object is accessible
      - `configuration` object, required
        - `type` 'recent_value' — Cache Variable will be set to the most recent value seen, based on the source event field and the extraction regex specified
        - `source` string — The path to the event field where the regex will be applied to extract a value.
        - `regex` string — A RE2 regular expression. If it contains one or more capture groups, their values will be extracted and appended together. If it contains no capture groups, the whole match is used.
      - `conditions` object[] — Each of these conditions is evaluated to check if an event matches this rule. The rule is considered a match if **any** of these conditions match.
        - `expression` string — A PCL condition string. Note: The `trigger_count` and `resetting_trigger_count` operators are unsupported for Cache Variables
    - OrchestrationCacheVariableTriggerEventCount — unresolved $ref
    - OrchestrationCacheVariableExternalData — unresolved $ref

## Other responses

- `400` — Caller provided invalid arguments. Please review the response for error details. Retrying with the same arguments will *not* work.
- `401` — Caller did not supply credentials or did not provide the correct credentials. If you are using an API key, it may be invalid or your Authorization header may be malformed.
- `403` — Caller is not authorized to view the requested resource. While your authentication is valid, the authenticated user or token does not have permission to perform this action.
- `404` — The requested resource was not found.
- `405` — The request was received and recognized by the server, but its HTTP method was rejected for the requested resource.

---

[API](https://skmtc.net/pagerduty/apis/rest-api.md) · [All operations](https://skmtc.net/pagerduty/apis/rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pagerduty/rest-api/revisions/b679a8f3f02c/schema)
