Routing Configs

Routing Configs define path-based routing rules that direct traffic to Fastly services based on URL path patterns and request conditions. A routing config is composed of one or more paths, each containing one or more rules that evaluate request conditions and select a destination service when matched.

Action

The action to take when a rule matches.

typestringThe type of action to take when a rule matches. Required.
valuestringThe value for the action. For service actions, this is the target Fastly service ID. Required.

Draft diff

The differences between the draft and active versions of a routing config.

addedarrayPaths that exist in the draft but not in the active version.
deletedarrayPaths that exist in the active version but not in the draft.
modifiedarrayPaths that exist in both versions but have changed.

Draft request (update)

All attributes for updating the draft version.

commentstringA freeform comment for the draft version.

Initial version

Optional initial version payload to seed the new routing config with paths and rules in a single request.

activatebooleanWhether to activate the initial version on creation. [Default false]
commentstringA freeform comment for the initial version.
pathsarrayThe paths to create on the initial version.

Initial version path

A path on the initial version, with its rules.

pathstringThe URL path pattern, beginning with /. Maximum 2048 characters. Required.
rulesarrayThe rules to create on this path.

Pagination metadata

Cursor-based pagination metadata.

limitintegerThe number of records returned per page.
next_cursorstringCursor value used to retrieve the next page of results. Empty if there are no more results.
previous_cursorstringCursor value used to retrieve the previous page of results. Empty if there is no previous page.
sortstringThe sort order applied to the results.

Path change

Modifications to an existing path between versions.

old_pathstringThe previous path pattern, if it changed.
pathstringThe current path pattern.
path_idstringAlphanumeric string identifying the path. Stable across versions of the routing config. Read-only.
rules_addedarrayRules that were added to this path.
rules_changedarrayRules that were modified on this path.
rules_deletedarrayRules that were removed from this path.

Path request (create)

All attributes for creating a path.

pathstringThe URL path pattern, beginning with /. Maximum 2048 characters. Required.

Path response

All attributes for a path response.

created_atstringDate and time in ISO 8601 format. Read-only.
idstringAlphanumeric string identifying the path. Stable across versions of the routing config. Read-only.
pathstringThe URL path pattern, beginning with /. Maximum 2048 characters.
updated_atstringDate and time in ISO 8601 format. Read-only.

Path request (update)

All attributes for updating a path.

pathstringThe URL path pattern, beginning with /. Maximum 2048 characters.

Path with rules

A path together with all of its rules.

pathobjectAll attributes for a path response.
rulesarray

Position

The position at which to place a new rule. At most one of before or after may be set. Cannot be used when creating a default (empty-conditions) rule.

afterstringThe id of the rule that this rule should be placed after.
beforestringThe id of the rule that this rule should be placed before.

Routing config request (create)

All attributes for creating a routing config.

initial_versionobjectOptional initial version payload to seed the new routing config with paths and rules in a single request.
namestringThe user-defined name for the routing config. Required.

Condition

A condition that must be met for a rule to match.

keystringThe key to evaluate. For header conditions this is the header name. Required for header conditions.
operatorstringThe comparison operator used to evaluate the condition. Required.
typestringThe type of condition. Required.
valuestringThe value to compare against using the operator. Required.

Routing config response

All attributes for a routing config response.

activated_atstringTimestamp of when the version was most recently activated. null if the version has never been activated. Read-only.
created_atstringDate and time in ISO 8601 format. Read-only.
idstringAlphanumeric string identifying the routing config. Read-only.
namestringThe user-defined name for the routing config.
statestringThe current state of the routing config's versions. Read-only.
updated_atstringDate and time in ISO 8601 format. Read-only.

Version response

All attributes for a routing config version response.

activated_atstringTimestamp of when the version was most recently activated. null if the version has never been activated. Read-only.
commentstringA freeform comment describing the version.
created_atstringDate and time in ISO 8601 format. Read-only.
idstringAlphanumeric string identifying the version. Read-only.

Rule change

A modification to an existing rule's action between versions.

new_actionobjectThe action to take when a rule matches.
old_actionobjectThe action to take when a rule matches.
rule_idstringAlphanumeric string identifying the rule. Stable across versions of the routing config. Read-only.

Rule request (create)

All attributes for creating a rule. A rule with an empty conditions array is the default (catch-all) rule for its path.

actionobjectThe action to take when a rule matches. Required.
conditionsarrayThe conditions a request must satisfy for this rule to match. An empty array indicates the default rule for the path. Required.
positionobjectThe position at which to place a new rule. At most one of before or after may be set. Cannot be used when creating a default (empty-conditions) rule.

Rule response

All attributes for a rule response.

actionobjectThe action to take when a rule matches.
conditionsarrayThe conditions a request must satisfy for this rule to match. Empty for the default rule.
created_atstringDate and time in ISO 8601 format. Read-only.
idstringAlphanumeric string identifying the rule. Stable across versions of the routing config. Read-only.
is_defaultbooleanWhether this is the default (catch-all) rule for the path. Read-only.
updated_atstringDate and time in ISO 8601 format. Read-only.

Rule request (update)

All attributes for updating a rule. At least one of action, conditions, or position must be provided.

actionobjectThe action to take when a rule matches.
conditionsarray
positionobjectThe position at which to place a new rule. At most one of before or after may be set. Cannot be used when creating a default (empty-conditions) rule.

Endpoints

List routing configs

GET/domain-management/v1/routing-configs

Create a routing config

POST/domain-management/v1/routing-configs

Get a routing config

GET/domain-management/v1/routing-configs/config_id

Delete a routing config

DELETE/domain-management/v1/routing-configs/config_id

List paths

GET/domain-management/v1/routing-configs/config_id/paths

Create a path

POST/domain-management/v1/routing-configs/config_id/paths

Get a path

GET/domain-management/v1/routing-configs/config_id/paths/path_id

Delete a path

DELETE/domain-management/v1/routing-configs/config_id/paths/path_id

Update a path

PATCH/domain-management/v1/routing-configs/config_id/paths/path_id

List rules

GET/domain-management/v1/routing-configs/config_id/paths/path_id/rules

Create a rule

POST/domain-management/v1/routing-configs/config_id/paths/path_id/rules

Get a rule

GET/domain-management/v1/routing-configs/config_id/paths/path_id/rules/rule_id

Delete a rule

DELETE/domain-management/v1/routing-configs/config_id/paths/path_id/rules/rule_id

Update a rule

PATCH/domain-management/v1/routing-configs/config_id/paths/path_id/rules/rule_id

Get the draft diff

GET/domain-management/v1/routing-configs/config_id/draft/diff

Discard the draft

DELETE/domain-management/v1/routing-configs/config_id/draft

Update the draft

PATCH/domain-management/v1/routing-configs/config_id/draft

Activate the draft

POST/domain-management/v1/routing-configs/config_id/activate

Deactivate a routing config

POST/domain-management/v1/routing-configs/config_id/deactivate

List versions

GET/domain-management/v1/routing-configs/config_id/versions

Reactivate a version

POST/domain-management/v1/routing-configs/config_id/versions/version_id/activate

Delete inactive versions

DELETE/domain-management/v1/routing-configs/config_id/versions/inactive