POST

Create redirect rule

https://linkshift.app/api/v1/redirect-rules

Redirect rules are deeply validated in backend logic. Key constraints include: - Source regex parsing and capture group consistency. - Destination URL structure and supported placeholder/functions validation. - Conditional expression and operator validation. - Link-map and destination exclusivity (`linkMapId` requires empty destination).

Operation ID:createRedirectRuleTags: Redirect Rules

Security

  • ApiKeyAuth: apiKey | header:X-API-Key | API key generated in LinkShift dashboard (`Organization -> Manage API keys`).

Parameters

This endpoint has no parameters.

Request body schema

requestBodyobjectrequired
Payload for creating a redirect rule.
destinationstring | nullnullable
Static destination URL. Keep null when using `linkMapId`.
maxLength: 16384
domainGroupIdstringrequired
Target domain-group ID.
linkMapIdstring | nullnullable
Optional link-map ID for key-based destinations.
matchMethodarray of string
Allowed request methods. Empty array means all methods.
pathMatchstring
Path matching strategy.
default: exactenum: exact, prefix
priorityinteger
Rule priority (higher first).
default: 0minimum: 0maximum: 1000
queryMatchstring
Query-string matching strategy.
default: exactenum: exact, ignore, subset
sourcestringrequired
Source matcher expression.
minLength: 1maxLength: 16384
statusCodeinteger
HTTP redirect status used for rule matches.
default: 302enum: 301, 302, 307, 308

Response schema

Created redirect rule

Content type: application/json
response 200objectrequired
Redirect rule resolved during request matching.
blockedAtstring | nullnullable
Timestamp when the rule was blocked.
format: date-time
createdAtstringrequired
Creation timestamp (UTC).
format: date-time
deletedAtstring | nullnullable
Soft-delete timestamp in UTC when deleted.
format: date-time
destinationstring | nullnullable
Static redirect destination URL. Null when dynamic destination is used via link map.
domainGroupIdstringrequired
Parent domain-group ID.
idstringrequired
Redirect-rule ID.
isBlockedboolean
Whether the rule is currently blocked from execution.
linkMapIdstring | nullnullable
Optional linked map used for key-based destinations.
matchMethodarray of stringrequired
Allowed request methods. Empty array means all methods.
pathMatchstringrequired
Path matching strategy.
enum: exact, prefix
priorityintegerrequired
Rule priority (higher first).
queryMatchstringrequired
Query-string matching strategy.
enum: exact, ignore, subset
sourcestringrequired
Source matcher expression.
statusCodeintegerrequired
HTTP redirect status returned for matches.
enum: 301, 302, 307, 308
updatedAtstringrequired
Last update timestamp (UTC).
format: date-time