Applications
Azion Lib functions of the azion package that manage applications, origins, cache settings, device groups, function instances, and rules on API v3.
The azion/applications module is the Azion Lib library for Applications. Its functions create, list, read, update, and delete applications. Inside an application, they manage its origins, cache settings, device groups, function instances, and rules. The module calls Azion API v3, and each function takes one object argument.
Install the package:
The azion package receives bug fixes only, and its maintenance ends in December 2026.
The samples on this page are ES modules that use top-level await, and they run in Node.js. Most of them are TypeScript. A sample whose payload TypeScript rejects is JavaScript, and its section names the type that rejects it.
Authentication
Functions that you import and call directly read your personal token from the AZION_TOKEN environment variable. A client from createAzionApplicationClient carries the token in its token field.
| Variable | Description |
|---|---|
AZION_TOKEN | Your Azion personal token. |
AZION_DEBUG | With true, turns on debug mode. |
For more information, refer to How Azion Lib works.
Response envelope
The azion/applications functions report a failure in one of two ways, depending on the object they act on:
- The application-level functions createApplication, getApplications, getApplication, patchApplication, and putApplication return
{ data }on success. When the API answers with an error status, they throwError: HTTP error! Status: <code> - <TEXT>, so call them insidetry/catch. - deleteApplication and the functions for origins, cache settings, device groups, function instances, and rules do not throw. They return an AzionApplicationResponse,
{ data?, error? }. On failure,errorholds{ message, operation }, whereoperationnames the call, such asget origin.
The samples for the application-level functions destructure error as well. On a failed request, those functions throw before the sample checks it.
A delete that succeeds still returns { error: { message: 'Expected JSON response, but got: ', operation } }. The API answers a delete with an empty body, which the module reads as an error. The envelope cannot tell a successful delete from a failed one, so each delete sample on this page reads the object back. A 404 answer confirms the delete.
Functions by resource
The module groups its functions by the object they manage. An application is addressed by applicationId, which every function except createApplication and getApplications takes. Rules also take a phase, and an origin is addressed by its originKey, a UUID.
| Resource | Functions |
|---|---|
| Application | createApplication, getApplications, getApplication, patchApplication, putApplication, deleteApplication |
| Origin | createOrigin, getOrigins, getOrigin, updateOrigin, deleteOrigin |
| Cache setting | createCacheSetting, getCacheSettings, getCacheSetting, updateCacheSetting, deleteCacheSetting |
| Device group | createDeviceGroup, getDeviceGroups, getDeviceGroup, updateDeviceGroup, deleteDeviceGroup |
| Function instance | createFunctionInstance, getFunctionInstances, getFunctionInstance, updateFunctionInstance, deleteFunctionInstance |
| Rule | createRule, getRules, getRule, updateRule, deleteRule |
An application that createApplication or getApplication returns also carries the functions of the five sub-resources as application methods.
createAzionApplicationClient
Creates a client that holds a token and exposes the six application-level functions as methods. createAzionApplicationClient is also the default export of the module. In TypeScript with moduleResolution set to nodenext, the default import is not callable, so import the named export. With moduleResolution set to bundler, both imports type-check.
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | No | Your Azion personal token. |
options | AzionClientOptions | No | Request options. No sample on this page passes them to the client. |
Returns an AzionApplicationsClient. Its methods take the same object as the matching function on this page. The client has no methods for origins, cache settings, device groups, function instances, or rules: call those functions directly, or use the application methods.
This sample creates a client and prints its methods:
Output:
createApplication
Creates an application.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | ApiBaseApplicationPayload | Yes | The settings of the application. name is required. |
options | AzionClientOptions | No | Request options. |
Returns data as the created AzionApplication, with the id the API assigned. On an error status, the function throws.
The type declares application_acceleration, but API v3 refuses it in a create request as an unknown field. With it, the function throws Error: HTTP error! Status: 400 - BAD REQUEST, so leave it out.
This sample is JavaScript, because TypeScript rejects the string 'http,https' for delivery_protocol, whose type is the DeliveryProtocol enum:
Output:
getApplications
Lists the applications of the account, one page at a time.
| Parameter | Type | Required | Description |
|---|---|---|---|
params | ApiListApplicationsParams | No | Pagination: page and page_size. Without ordering keys, the function asks for the list ordered by name, in ascending order. |
options | AzionClientOptions | No | Request options. |
Returns an AzionApplicationCollectionResponse: data.results holds the page, and data.count holds the number of applications in the account. On an error status, the function throws.
Output:
getApplication
Returns one application by its ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
options | AzionClientOptions | No | Request options. |
Returns data as an AzionApplication that carries the application methods. An ID that matches no application makes the function throw Error: HTTP error! Status: 404 - NOT FOUND.
Output:
patchApplication
Sends the application fields you pass in a PATCH request. Use it to rename an application or to change one setting, such as edge_functions: true, which createFunctionInstance requires.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application to update. |
data | ApiUpdateApplicationPayload | Yes | The fields to change. Every field is optional. |
options | AzionClientOptions | No | Request options. |
Returns data as the updated AzionApplication. On an error status, the function throws.
Output:
putApplication
Sends the application settings you pass in a PUT request.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application to update. |
data | ApiUpdateApplicationPayload | Yes | The settings of the application. |
options | AzionClientOptions | No | Request options. |
Returns data as the updated AzionApplication. On an error status, the function throws.
API v3 can refuse a delivery_protocol value that the type allows. For example, the API can answer delivery_protocol: 'https' with "https" is not a valid choice., and the function then throws.
This sample is JavaScript, because TypeScript rejects the string 'http' for delivery_protocol, whose type is the DeliveryProtocol enum:
Output:
deleteApplication
Deletes an application by its ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application to delete. |
options | AzionClientOptions | No | Request options. |
Unlike the other application-level functions, deleteApplication returns an envelope and does not throw. A successful delete returns error with the message Expected JSON response, but got: , so the sample confirms the delete with getApplication, which throws a 404 error for an application that no longer exists.
Output:
createOrigin
Creates an origin in an application. An origin is the server the application retrieves content from.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
data | ApiCreateOriginPayload | Yes | The settings of the origin. The sample sets name, origin_type, addresses, and host_header. |
options | AzionClientOptions | No | Request options. |
Returns data as the created AzionOrigin. The API identifies an origin by its origin_key, a UUID, which the other origin functions take as originKey.
This sample is JavaScript, because ApiCreateOriginPayload requires every origin field, including origin_key and the HMAC fields, and types origin_type as an enum:
Output:
getOrigins
Lists the origins of an application, one page at a time.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
params | ApiListOriginsParams | No | Pagination: page and page_size. |
options | AzionClientOptions | No | Request options. |
Returns an AzionApplicationCollectionResponse whose data.results holds AzionOrigin objects.
Output:
getOrigin
Returns one origin of an application by its origin key.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
originKey | string | Yes | The origin_key of the origin, a UUID. |
options | AzionClientOptions | No | Request options. |
Returns data as an AzionOrigin. A key that matches no origin returns error with the message HTTP error! Status: 404 - NOT FOUND and the operation get origin.
Output:
updateOrigin
Sends the origin fields you pass in a PATCH request.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
originKey | string | Yes | The origin_key of the origin to update. |
data | ApiUpdateOriginRequest | Yes | The fields to change. |
options | AzionClientOptions | No | Request options. |
Returns data as the updated AzionOrigin.
This sample is JavaScript, because ApiUpdateOriginRequest requires an id, which the request does not need:
Output:
deleteOrigin
Deletes an origin of an application by its origin key.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
originKey | string | Yes | The origin_key of the origin to delete. |
options | AzionClientOptions | No | Request options. |
A successful delete returns error with the message Expected JSON response, but got: , so the sample reads the origin back with getOrigin. A 404 error confirms the delete.
Output:
createCacheSetting
Creates a cache setting in an application. The application must have an origin first. On an application with none, the API refuses the cache setting, and the function returns error with the message HTTP error! Status: 400 - BAD REQUEST.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
data | ApiBaseCacheSettingPayload | Yes | The settings of the cache setting. name is required. |
options | AzionClientOptions | No | Request options. |
browser_cache_settings takes honor, override, or ignore, and cdn_cache_settings takes honor or override. With override, the sample also sets the matching maximum TTL field, browser_cache_settings_maximum_ttl or cdn_cache_settings_maximum_ttl.
Returns data as the created AzionCacheSetting, with its id.
This sample is JavaScript, because TypeScript rejects string values for browser_cache_settings and cdn_cache_settings, whose types are enums the module does not export:
Output:
getCacheSettings
Lists the cache settings of an application, one page at a time.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
params | ApiListCacheSettingsParams | No | Pagination: page and page_size. Leave out sort and order: the API refuses the values the type declares for them with a 400 error. |
options | AzionClientOptions | No | Request options. |
Returns an AzionApplicationCollectionResponse whose data.results holds AzionCacheSetting objects.
Output:
getCacheSetting
Returns one cache setting of an application by its ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
cacheSettingId | number | Yes | The ID of the cache setting. |
options | AzionClientOptions | No | Request options. |
Returns data as an AzionCacheSetting.
Output:
updateCacheSetting
Sends the cache setting fields you pass in a PATCH request.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
cacheSettingId | number | Yes | The ID of the cache setting to update. |
data | ApiUpdateCacheSettingPayload | Yes | The fields to change. Every field is optional. |
options | AzionClientOptions | No | Request options. |
Returns data as the updated AzionCacheSetting. A payload without enum fields, such as name and a TTL, type-checks in TypeScript.
Output:
deleteCacheSetting
Deletes a cache setting of an application by its ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
cacheSettingId | number | Yes | The ID of the cache setting to delete. |
options | AzionClientOptions | No | Request options. |
A successful delete returns error with the message Expected JSON response, but got: , so the sample reads the cache setting back with getCacheSetting. A 404 error confirms the delete.
Output:
createDeviceGroup
Creates a device group in an application. A device group matches devices by a regular expression that the platform compares with the User-Agent request header.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
data | { name: string; user_agent: string } | Yes | name names the group, and user_agent holds the regular expression, such as Mobile|Android|iPhone. |
options | AzionClientOptions | No | Request options. |
Returns data as the created AzionDeviceGroup. The API refuses a name that contains a space or a hyphen. The function then returns error with the message HTTP error! Status: 400 - BAD REQUEST.
Output:
getDeviceGroups
Lists the device groups of an application, one page at a time.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
params | ApiListDeviceGroupsParams | No | Pagination: page and page_size. |
options | AzionClientOptions | No | Request options. |
Returns an AzionApplicationCollectionResponse whose data.results holds AzionDeviceGroup objects.
Output:
getDeviceGroup
Returns one device group of an application by its ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
deviceGroupId | number | Yes | The ID of the device group. |
options | AzionClientOptions | No | Request options. |
Returns data as an AzionDeviceGroup.
Output:
updateDeviceGroup
Sends the device group fields you pass in a PATCH request. The new name follows the same rule as on create: no spaces and no hyphens.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
deviceGroupId | number | Yes | The ID of the device group to update. |
data | { name?: string; user_agent?: string } | Yes | The fields to change. |
options | AzionClientOptions | No | Request options. |
Returns data as the updated AzionDeviceGroup.
Output:
deleteDeviceGroup
Deletes a device group of an application by its ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
deviceGroupId | number | Yes | The ID of the device group to delete. |
options | AzionClientOptions | No | Request options. |
A successful delete returns error with the message Expected JSON response, but got: , so the sample reads the device group back with getDeviceGroup. A 404 error confirms the delete.
Output:
createFunctionInstance
Creates a function instance in an application. An instance runs an existing function for that application, with the arguments the instance sets.
Two things must exist first. The application must have functions turned on, which patchApplication does with data: { edge_functions: true }. The function must exist too: the instance names it by its ID in edge_function_id, and the azion package has no module that creates functions.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
data | ApiCreateFunctionInstancePayload | Yes | name, the edge_function_id of the function, and the args the function receives. |
options | AzionClientOptions | No | Request options. |
Returns data as the created AzionFunctionInstance, with its id.
Output:
getFunctionInstances
Lists the function instances of an application, one page at a time.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
params | ApiListFunctionInstancesParams | No | Pagination: page and page_size. |
options | AzionClientOptions | No | Request options. |
Returns an AzionApplicationCollectionResponse whose data.results holds AzionFunctionInstance objects.
Output:
getFunctionInstance
Returns one function instance of an application by its ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
functionInstanceId | number | Yes | The ID of the function instance. |
options | AzionClientOptions | No | Request options. |
Returns data as an AzionFunctionInstance.
Output:
updateFunctionInstance
Sends the function instance fields you pass in a PATCH request.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
functionInstanceId | number | Yes | The ID of the function instance to update. |
data | ApiUpdateFunctionInstancePayload | Yes | The fields to change. The sample changes name. |
options | AzionClientOptions | No | Request options. |
Returns data as the updated AzionFunctionInstance.
Output:
deleteFunctionInstance
Deletes a function instance of an application by its ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
functionInstanceId | number | Yes | The ID of the function instance to delete. |
options | AzionClientOptions | No | Request options. |
A successful delete returns error with the message Expected JSON response, but got: , so the sample reads the instance back with getFunctionInstance. A 404 error confirms the delete.
Output:
createRule
Creates a rule of the Rules Engine of an application, in the request phase or the response phase.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
phase | 'request' | 'response' | Yes | The phase the rule runs in. |
data | ApiCreateRulePayload | Yes | The rule: name, phase, criteria, and behaviors. |
options | AzionClientOptions | No | Request options. |
criteria is a list of condition groups, and each group is a list of conditions with variable, operator, conditional, and input_value. behaviors lists the actions, each with a name and a target. For the variables, operators, and behavior names a rule can use, refer to Rules Engine for Applications.
Returns data as the created AzionRule, with its id and order. In the sample, as const keeps the literal types that phase and conditional need in TypeScript.
Output:
getRules
Lists the rules of one phase of an application, one page at a time.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
phase | 'request' | 'response' | Yes | The phase to list. |
params | ApiListRulesParams | No | Pagination: page and page_size. |
options | AzionClientOptions | No | Request options. |
Returns an AzionApplicationCollectionResponse whose data.results holds AzionRule objects. The request list also holds Default Rule, the rule in phase default that a new application already has.
Output:
getRule
Returns one rule of an application by its phase and ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
phase | 'request' | 'response' | Yes | The phase of the rule. |
ruleId | number | Yes | The ID of the rule. |
options | AzionClientOptions | No | Request options. |
Returns data as an AzionRule.
Output:
updateRule
Sends the rule fields you pass in a PATCH request. Fields you leave out keep their values: a call that does not send criteria leaves the criteria of the rule unchanged.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
phase | 'request' | 'response' | Yes | The phase of the rule. |
ruleId | number | Yes | The ID of the rule to update. |
data | ApiUpdateRulePayload | Yes | The fields to change. Every field is optional. |
options | AzionClientOptions | No | Request options. |
Returns data as the updated AzionRule.
Output:
deleteRule
Deletes a rule of an application by its phase and ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
applicationId | number | Yes | The ID of the application. |
phase | 'request' | 'response' | Yes | The phase of the rule. |
ruleId | number | Yes | The ID of the rule to delete. |
options | AzionClientOptions | No | Request options. |
A successful delete returns error with the message Expected JSON response, but got: , so the sample reads the rule back with getRule. A 404 error confirms the delete.
Output:
Application methods
An application that createApplication or getApplication returns carries the sub-resource functions as methods, already bound to its ID. Each method takes the same object as the matching function, without applicationId. The rule methods sit under rules.request and rules.response, which also fix the phase.
| Property | Type | Methods |
|---|---|---|
origins | OriginOperations | createOrigin, getOrigins, getOrigin, updateOrigin, deleteOrigin |
cache | CacheOperations | createCacheSetting, getCacheSettings, getCacheSetting, updateCacheSetting, deleteCacheSetting |
devices | DeviceGroupOperations | createDeviceGroup, getDeviceGroups, getDeviceGroup, updateDeviceGroup, deleteDeviceGroup |
functions | FunctionOperations | createFunctionInstance, getFunctionInstances, getFunctionInstance, updateFunctionInstance, deleteFunctionInstance |
rules.request, rules.response | RuleOperations | createRule, getRules, getRule, updateRule, deleteRule |
A list method needs an object argument, even an empty one: {}. This sample reads an application and lists each of its sub-resources through the methods:
Output:
Errors
The application-level functions throw these messages inside an Error. The other functions return them in error.message, and error.operation names the call, such as create device group.
| Message | Cause | What to do |
|---|---|---|
HTTP error! Status: 401 - UNAUTHORIZED | No valid token reached the call: AZION_TOKEN is unset or holds an invalid token, and no client token was passed. | Set AZION_TOKEN to a valid personal token, or pass token to createAzionApplicationClient. |
HTTP error! Status: 404 - NOT FOUND | No application has that ID, or the application holds no object with that ID or origin key. | Check the ID with the matching list function, such as getApplications or getOrigins. |
HTTP error! Status: 400 - BAD REQUEST | API v3 refused the payload. The message does not carry the reason the API gives. Causes include application_acceleration in a create request, a cache setting on an application with no origin, a device group name with a space or a hyphen, and sort or order in a cache setting list. | Compare the payload with the section of the function you called, and remove or change the field it names. |
Expected JSON response, but got: | A delete succeeded, and the API answered with an empty body. | Read the object back. A 404 error confirms the delete. |
Types
The azion/applications module exports these types, except where a type says otherwise. Import them with import type.
AzionApplicationsClient
The client that createAzionApplicationClient returns. Each method takes one object.
| Method | Argument | Returns |
|---|---|---|
createApplication | { data: ApiCreateApplicationPayload; options?: AzionClientOptions } | Promise<AzionApplicationResponse<AzionApplication>> |
getApplication | { applicationId: number; options?: AzionClientOptions } | Promise<AzionApplicationResponse<AzionApplication>> |
getApplications | { params?: AzionApplicationCollectionOptions; options?: AzionClientOptions } | Promise<AzionApplicationCollectionResponse<AzionApplication>> |
putApplication | { applicationId: number; data: ApiUpdateApplicationPayload; options?: AzionClientOptions } | Promise<AzionApplicationResponse<AzionApplication>> |
patchApplication | { applicationId: number; data: Partial<ApiUpdateApplicationPayload>; options?: AzionClientOptions } | Promise<AzionApplicationResponse<AzionApplication>> |
deleteApplication | { applicationId: number; options?: AzionClientOptions } | Promise<AzionApplicationResponse<void>> |
CreateAzionApplicationClient
The type of createAzionApplicationClient.
AzionClientOptions
Request options that every function takes in options.
| Property | Type | Required | Description |
|---|---|---|---|
debug | boolean | No | Turns on debug mode. |
force | boolean | No | Declared by the type. No sample on this page uses it. |
AzionApplicationResponse
The envelope that every function except the list functions returns. For how to read it, refer to Response envelope.
| Property | Type | Required | Description |
|---|---|---|---|
data | T | No | The result of the call. |
error | { message: string; operation: string } | No | The error message and the operation that failed. A successful delete also fills it. |
AzionApplicationCollectionResponse
The envelope that the list functions return.
| Property | Type | Required | Description |
|---|---|---|---|
data | { count; total_pages; schema_version; links; results } | No | The page of results. |
data.count | number | Yes | The number of objects in the whole list, not on the page. |
data.total_pages | number | Yes | The number of pages. |
data.schema_version | number | Yes | The schema version of the API response. |
data.links | { previous: string | null; next: string | null } | Yes | The previous and next pages. |
data.results | T[] | Yes | The objects on the page. |
error | { message: string; operation: string } | No | The error message and the operation that failed. |
AzionApplication
An application: the fields of ApiBaseApplicationPayload, plus the ID and the application methods. AzionApplicationSettings is the same shape without the methods.
| Property | Type | Required | Description |
|---|---|---|---|
id | number | Yes | The ID of the application. |
origins | OriginOperations | Yes | The origin methods. |
cache | CacheOperations | Yes | The cache setting methods. |
devices | DeviceGroupOperations | Yes | The device group methods. |
functions | FunctionOperations | Yes | The function instance methods. |
rules | { request: RuleOperations; response: RuleOperations } | Yes | The rule methods, one set per phase. |
ApiBaseApplicationPayload
The settings of an application. name is required and every other field is optional. ApiCreateApplicationPayload, which the module does not export, has the same shape, and ApiUpdateApplicationPayload makes every field optional. API v3 refuses application_acceleration in a create request.
The enums of the application settings, which the module exports:
ApiListApplicationsParams
Pagination and ordering for getApplications. AzionApplicationCollectionOptions, which the client method takes, has the same keys.
| Property | Type | Required | Description |
|---|---|---|---|
page | number | No | The page number. |
page_size | number | No | The number of applications per page. |
sort | 'name' | 'id' | No | Declared by the type. No sample on this page uses it. |
order_by | string | No | Declared by the type. No sample on this page uses it. |
AzionOrigin
An origin, with its origin_key. ApiCreateOriginPayload takes every field below except id and method, all required, plus optional origin_path, hmac_authentication, hmac_region_name, hmac_access_key, hmac_secret_key, connection_timeout, and timeout_between_bytes. ApiUpdateOriginRequest makes every field optional and requires id.
The enums of an origin, which the module does not export:
AzionCacheSetting
A cache setting: the fields of ApiBaseCacheSettingPayload, plus its id (number).
ApiBaseCacheSettingPayload
The settings of a cache setting. name is required and every other field is optional. ApiUpdateCacheSettingPayload makes every field optional.
The enums of a cache setting, which the module does not export:
AzionDeviceGroup
A device group. ApiCreateDeviceGroupPayload and ApiUpdateDeviceGroupPayload, which the module does not export, take name and user_agent, both required on create and optional on update.
| Property | Type | Required | Description |
|---|---|---|---|
id | number | Yes | The ID of the device group. |
name | string | Yes | The name of the group, with no spaces and no hyphens. |
user_agent | string | Yes | The regular expression compared with the User-Agent request header. |
AzionFunctionInstance
A function instance. The API returns the four fields below, as the samples show.
| Property | Type | Description |
|---|---|---|
id | number | The ID of the function instance. |
edge_function_id | number | The ID of the function the instance runs. |
name | string | The name of the function instance. |
args | Record<string, unknown> | The arguments the function receives. |
The type declares other fields: id plus the fields of ApiBaseFunctionInstancePayload, which are name, code, language ('JavaScript'), initiator_type ('edge_application' \| 'edge_firewall'), active, and json_args. ApiUpdateFunctionInstancePayload makes those fields optional.
ApiCreateFunctionInstancePayload
The payload of createFunctionInstance. The module does not export this type.
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The name of the function instance. |
edge_function_id | number | Yes | The ID of the function the instance runs. |
args | Record<string, unknown> | Yes | The arguments the function receives. |
active | boolean | No | Declared by the type. No sample on this page uses it. |
AzionRule
A rule: the fields of ApiCreateRulePayload, plus id (number). AzionRule declares is_active and order as required, and every rule in the samples carries both.
ApiCreateRulePayload
The payload of createRule. ApiUpdateRulePayload makes every field optional.
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The name of the rule. |
phase | 'request' | 'response' | Yes | The phase of the rule. |
criteria | Criterion[][] | Yes | The condition groups. Each Criterion holds variable (string), operator (string), conditional ('if' | 'and' | 'or'), and input_value (string). |
behaviors | Behavior[] | Yes | The actions. Each Behavior holds name (string) and an optional target: a string, null, or { captured_array: string; subject: string; regex: string }. |
is_active | boolean | No | Whether the rule is active. A rule created without it is active. |
order | number | No | The position of the rule in its phase. |
description | string | No | The description of the rule. |
List parameters
The params object of each sub-resource list function declares these keys. The samples send only page and page_size. ApiListDeviceGroupsParams is not exported.
| Type | Declared keys |
|---|---|
ApiListOriginsParams | page, page_size, sort ('name' | 'id'), order ('asc' | 'desc'), filter |
ApiListCacheSettingsParams | page, page_size, sort ('name' | 'id'), order ('asc' | 'desc') |
ApiListDeviceGroupsParams | page, page_size, sort ('name' | 'id'), order ('asc' | 'desc') |
ApiListFunctionInstancesParams | page, page_size, sort ('name' | 'id'), order ('asc' | 'desc'), order_by, filter |
ApiListRulesParams | page, page_size, sort (string), order ('asc' | 'desc'), filter |