Download OpenAPI specification:
WordPress API documentation for Redirection.
These endpoints are used by the Redirection plugin itself, and can also be used externally.
This documentation is based on the currently maintained REST routes. It is not yet exhaustive, and the API should not be considered stable.
All requests must be authenticated. Most endpoints require a user with the relevant Redirection capability; in practice this often means an administrator. See the REST API authentication guide.
Get a paged list of redirects after applying filters and ordering.
| filterBy[status] | string Enum: "enabled" "disabled" |
| filterBy[url] | string |
| filterBy[url-match] | string Enum: "regular" "plain" |
| filterBy[match] | string |
| filterBy[action] | string |
| filterBy[http] | integer |
| filterBy[access] | string Enum: "year" "month" "all" |
| filterBy[target] | string |
| filterBy[title] | string |
| filterBy[group] | integer |
| filterBy[id] | integer |
| filterBy[module] | integer |
| orderby | string Enum: "source" "last_count" "last_access" "position" "id" |
| direction | string Enum: "asc" "desc" |
| per_page | integer [ 1 .. 200 ] Default: 25 |
| page | integer Default: 0 |
{- "items": [
- {
- "id": 0,
- "url": "string",
- "match_url": "string",
- "match_data": { },
- "match_type": "string",
- "action_type": "string",
- "action_code": 0,
- "action_data": { },
- "title": "string",
- "hits": 0,
- "regex": true,
- "group_id": 0,
- "position": 0,
- "last_access": "string",
- "status": "string"
}
], - "total": 0
}Create a new redirect and return the current redirect list.
| status | string Enum: "enabled" "disabled" |
| position | integer |
string or Array of strings | |
| regex | boolean |
| match_type | string Enum: "url" "referrer" "agent" "login" "header" "custom" "cookie" "role" "server" "ip" "page" "language" |
object | |
| title | string |
| group_id | integer |
| action_type | string |
| action_code | integer |
object |
{- "status": "enabled",
- "position": 0,
- "url": "string",
- "regex": true,
- "match_type": "url",
- "match_data": { },
- "title": "string",
- "group_id": 0,
- "action_type": "string",
- "action_code": 0,
- "action_data": { }
}{- "items": [
- {
- "id": 0,
- "url": "string",
- "match_url": "string",
- "match_data": { },
- "match_type": "string",
- "action_type": "string",
- "action_code": 0,
- "action_data": { },
- "title": "string",
- "hits": 0,
- "regex": true,
- "group_id": 0,
- "position": 0,
- "last_access": "string",
- "status": "string"
}
], - "total": 0
}Update an existing redirect.
| id required | integer |
| status | string Enum: "enabled" "disabled" |
| position | integer |
string or Array of strings | |
| regex | boolean |
| match_type | string Enum: "url" "referrer" "agent" "login" "header" "custom" "cookie" "role" "server" "ip" "page" "language" |
object | |
| title | string |
| group_id | integer |
| action_type | string |
| action_code | integer |
object |
{- "status": "enabled",
- "position": 0,
- "url": "string",
- "regex": true,
- "match_type": "url",
- "match_data": { },
- "title": "string",
- "group_id": 0,
- "action_type": "string",
- "action_code": 0,
- "action_data": { }
}{- "items": [
- {
- "id": 0,
- "url": "string",
- "match_url": "string",
- "match_data": { },
- "match_type": "string",
- "action_type": "string",
- "action_code": 0,
- "action_data": { },
- "title": "string",
- "hits": 0,
- "regex": true,
- "group_id": 0,
- "position": 0,
- "last_access": "string",
- "status": "string"
}
], - "total": 0
}Enable, disable, delete, or reset a set of redirects.
| bulk required | string Enum: "delete" "enable" "disable" "reset" |
| filterBy[status] | string Enum: "enabled" "disabled" |
| filterBy[url] | string |
| filterBy[url-match] | string Enum: "regular" "plain" |
| filterBy[match] | string |
| filterBy[action] | string |
| filterBy[http] | integer |
| filterBy[access] | string Enum: "year" "month" "all" |
| filterBy[target] | string |
| filterBy[title] | string |
| filterBy[group] | integer |
| filterBy[id] | integer |
| filterBy[module] | integer |
| orderby | string Enum: "source" "last_count" "last_access" "position" "id" |
| direction | string Enum: "asc" "desc" |
| per_page | integer [ 1 .. 200 ] Default: 25 |
| page | integer Default: 0 |
Array of integers or strings | |
| global | boolean Default: false |
{- "items": [
- 0
], - "global": false
}{- "items": [
- {
- "id": 0,
- "url": "string",
- "match_url": "string",
- "match_data": { },
- "match_type": "string",
- "action_type": "string",
- "action_code": 0,
- "action_data": { },
- "title": "string",
- "hits": 0,
- "regex": true,
- "group_id": 0,
- "position": 0,
- "last_access": "string",
- "status": "string"
}
], - "total": 0
}Get a paged list of groups after applying filters and ordering.
| filterBy[name] | string |
| filterBy[status] | string Enum: "enabled" "disabled" |
| filterBy[module] | integer |
| orderby | string Value: "name" |
| direction | string Enum: "asc" "desc" |
| per_page | integer [ 1 .. 200 ] Default: 25 |
| page | integer Default: 0 |
{- "items": [
- {
- "id": 0,
- "name": "string",
- "enabled": true,
- "redirects": 0,
- "moduleName": "string",
- "module_id": 0
}
], - "total": 0
}Create a new group and return the current group list.
| name | string |
| moduleID | integer Enum: 1 2 3 |
| enabled | boolean |
{- "name": "string",
- "moduleID": 1,
- "enabled": true
}{- "items": [
- {
- "id": 0,
- "name": "string",
- "enabled": true,
- "redirects": 0,
- "moduleName": "string",
- "module_id": 0
}
], - "total": 0
}Update an existing group.
| id required | integer |
| name | string |
| moduleID | integer Enum: 1 2 3 |
| enabled | boolean |
{- "name": "string",
- "moduleID": 1,
- "enabled": true
}{- "item": {
- "id": 0,
- "name": "string",
- "enabled": true,
- "redirects": 0,
- "moduleName": "string",
- "module_id": 0
}
}Enable, disable, or delete groups.
| type required | string Enum: "delete" "enable" "disable" |
| filterBy[name] | string |
| filterBy[status] | string Enum: "enabled" "disabled" |
| filterBy[module] | integer |
| orderby | string Value: "name" |
| direction | string Enum: "asc" "desc" |
| per_page | integer [ 1 .. 200 ] Default: 25 |
| page | integer Default: 0 |
Array of integers or strings | |
| global | boolean Default: false |
{- "items": [
- 0
], - "global": false
}{- "items": [
- {
- "id": 0,
- "name": "string",
- "enabled": true,
- "redirects": 0,
- "moduleName": "string",
- "module_id": 0
}
], - "total": 0
}Get a paged list of redirect logs after applying filters and ordering.
| filterBy[ip] | string |
| filterBy[url] | string |
| filterBy[url-exact] | string |
| filterBy[referrer] | string |
| filterBy[agent] | string |
| filterBy[target] | string |
| filterBy[domain] | string |
| filterBy[redirect_by] | string |
| filterBy[method] | string Enum: "head" "get" "post" |
| orderby | string Enum: "ip" "url" "total" "count" |
| direction | string Enum: "asc" "desc" |
| per_page | integer [ 1 .. 200 ] Default: 25 |
| page | integer Default: 0 |
| groupBy | string Enum: "ip" "url" "agent" |
{- "items": [
- {
- "id": 0,
- "created": "string",
- "created_time": 0,
- "url": "string",
- "agent": "string",
- "referrer": "string",
- "ip": "string",
- "target": "string",
- "domain": "string",
- "redirect_by": "string",
- "count": 0
}
], - "total": 0
}Delete redirect logs by filter and return the refreshed list.
| property name* additional property | any |
{ }{- "items": [
- {
- "id": 0,
- "created": "string",
- "created_time": 0,
- "url": "string",
- "agent": "string",
- "referrer": "string",
- "ip": "string",
- "target": "string",
- "domain": "string",
- "redirect_by": "string",
- "count": 0
}
], - "total": 0
}Delete redirect logs by ID or current grouping.
| type required | string Value: "delete" |
Array of integers or strings | |
| global | boolean Default: false |
| groupBy | string Enum: "ip" "url" "agent" |
{- "items": [
- 0
], - "global": false,
- "groupBy": "ip"
}{- "items": [
- {
- "id": 0,
- "created": "string",
- "created_time": 0,
- "url": "string",
- "agent": "string",
- "referrer": "string",
- "ip": "string",
- "target": "string",
- "domain": "string",
- "redirect_by": "string",
- "count": 0
}
], - "total": 0
}Get a paged list of 404 logs after applying filters and ordering.
| filterBy[ip] | string |
| filterBy[url] | string |
| filterBy[url-exact] | string |
| filterBy[referrer] | string |
| filterBy[agent] | string |
| filterBy[target] | string |
| filterBy[domain] | string |
| filterBy[method] | string Enum: "head" "get" "post" |
| filterBy[http] | integer |
| orderby | string Enum: "ip" "url" "total" "count" |
| direction | string Enum: "asc" "desc" |
| per_page | integer [ 1 .. 200 ] Default: 25 |
| page | integer Default: 0 |
| groupBy | string Enum: "ip" "url" "agent" |
{- "items": [
- {
- "id": 0,
- "created": "string",
- "created_time": 0,
- "url": "string",
- "agent": "string",
- "referrer": "string",
- "ip": "string",
- "domain": "string",
- "http_code": 0,
- "count": 0
}
], - "total": 0
}Delete 404 logs by ID or current grouping.
| type required | string Value: "delete" |
Array of integers or strings | |
| global | boolean Default: false |
| groupBy | string Enum: "ip" "url" "agent" |
{- "items": [
- 0
], - "global": false,
- "groupBy": "ip"
}{- "items": [
- {
- "id": 0,
- "created": "string",
- "created_time": 0,
- "url": "string",
- "agent": "string",
- "referrer": "string",
- "ip": "string",
- "domain": "string",
- "http_code": 0,
- "count": 0
}
], - "total": 0
}Partial updates are supported and only supplied values are changed.
object |
{- "settings": { }
}{- "settings": { },
- "groups": [
- {
- "label": "string",
- "value": 0
}
], - "installed": "string",
- "canDelete": true,
- "post_types": [
- "string"
]
}Import redirects and other supported sections from an uploaded file.
| group_id required | integer |
| file | string <binary> |
| dry_run | boolean |
| duplicate_mode | string Enum: "import" "ignore" "update" |
| deduplicate | boolean |
| import_sections | Array of strings |
{- "created": 0,
- "updated": 0,
- "ignored": 0,
- "groups_created": 0,
- "groups_imported": 0,
- "logs_imported": 0,
- "errors_imported": 0,
- "settings_imported": 0,
- "preview": [
- {
- "source": "string",
- "target": "string",
- "code": 0,
- "regex": true,
- "group": "string",
- "result": "created",
- "redirect_id": 0
}
]
}Import redirects from one or more supported plugins.
string or Array of strings | |
| group_id | integer |
| duplicate_mode | string Enum: "import" "ignore" "update" |
| delete_source | boolean |
{- "plugin": "string",
- "group_id": 0,
- "duplicate_mode": "import",
- "delete_source": true
}{- "created": 0,
- "updated": 0,
- "ignored": 0,
- "groups_created": 0,
- "groups_imported": 0,
- "logs_imported": 0,
- "errors_imported": 0,
- "settings_imported": 0,
- "preview": [
- {
- "source": "string",
- "target": "string",
- "code": 0,
- "regex": true,
- "group": "string",
- "result": "created",
- "redirect_id": 0
}
]
}Run a dry-run preview for a plugin importer.
| plugin required | string |
| group_id | integer |
| duplicate_mode | string Enum: "import" "ignore" "update" |
| delete_source | boolean |
{- "created": 0,
- "updated": 0,
- "ignored": 0,
- "groups_created": 0,
- "groups_imported": 0,
- "logs_imported": 0,
- "errors_imported": 0,
- "settings_imported": 0,
- "preview": [
- {
- "source": "string",
- "target": "string",
- "code": 0,
- "regex": true,
- "group": "string",
- "result": "created",
- "redirect_id": 0
}
]
}Export redirects in CSV, JSON, Apache, or Nginx format.
| format required | string Enum: "csv" "json" "apache" "nginx" |
| module | string |
| filterBy[group] | integer |
| filterBy[module] | integer |
{- "data": "string",
- "total": 0
}