Skip to main content

You can either get a list of all your rules or look up a specific rule using its unique ID.

Get All Rules

Retrieve all rules associated with your Requestly workspace. This endpoint supports pagination for managing large sets of data. For a live view and to test this API interactively, visit the API Playground.

Endpoint

  • Method: GET
  • URL: https://api2.requestly.io/v1/rules

Query Parameters

ParameterTypeDescriptionRequiredDefault Value
offsetIntegerThe index from where the results should start. Use the value received in nextOffset from the previous response.No0
pageSizeIntegerNumber of results to return. Maximum value is 75.No30

cURL Example:

curl --request GET \
  --url https://api2.requestly.io/v1/rules \
  --header 'accept: application/json' \
  --header 'x-api-key: your_api_key'

Sample Responses

{
  "success": true,
  "data": [
    {
      "createdBy": "IUAGkRiEx6XI0B6qCc82qbwroKX2",
      "creationDate": 1735820120338,
      "currentOwnerId": "IUAGkRiEx6XI0B6qCc82qbwroKX2",
      "description": "hello ",
      "extensionRules": [
        {
          "action": {
            "redirect": {
              "url": "https://www.bing.com/"
            },
            "type": "redirect"
          },
          "condition": {
            "excludedInitiatorDomains": [
              "requestly.io"
            ],
            "excludedRequestDomains": [
              "requestly.io"
            ],
            "isUrlFilterCaseSensitive": true,
            "urlFilter": "https://www.google.com/"
          }
        }
      ],
      "groupId": "",
      "id": "Redirect_a9qau",
      "isFavourite": false,
      "isSample": false,
      "lastModifiedBy": "IUAGkRiEx6XI0B6qCc82qbwroKX2",
      "modificationDate": 1735820120338,
      "name": "test",
      "objectType": "rule",
      "pairs": [
        {
          "destination": "https://www.bing.com/",
          "destinationType": "url",
          "id": "8id6k",
          "source": {
            "key": "Url",
            "operator": "Contains",
            "value": "https://www.google.com/"
          }
        }
      ],
      "ruleType": "Redirect",
      "schemaVersion": "3.0.0",
      "status": "Inactive"
    }
    // ... other rules
  ],
  "total": 56,
  "nextOffset": 31,
} 

Retrieve a Specific Rule

This endpoint allows you to fetch details about a specific rule in your Requestly account by its unique ruleId. For a live view and to test this API interactively, visit the API Playground.

Endpoint

  • Method: GET
  • URL: https://api2.requestly.io/v1/rules/{ruleId}

Path Parameters

ParameterTypeDescriptionRequired
ruleIdStringThe unique ID of the rule to be retrieved.Yes

cURL Example

curl --request GET \
  --url https://api2.requestly.io/v1/rules/Redirect_a9qau \
  --header 'accept: application/json' \
  --header 'x-api-key: your_api_key'

Sample Response

{
  "success": true,
  "data": {
    "createdBy": "IUAGkRiEx6XI0B6qCc82qbwroKX2",
    "creationDate": 1735820120338,
    "currentOwnerId": "IUAGkRiEx6XI0B6qCc82qbwroKX2",
    "description": "hello",
    "extensionRules": [
      {
        "action": {
          "redirect": {
            "url": "https://www.bing.com/"
          },
          "type": "redirect"
        },
        "condition": {
          "excludedInitiatorDomains": ["requestly.io"],
          "excludedRequestDomains": ["requestly.io"],
          "isUrlFilterCaseSensitive": true,
          "urlFilter": "https://www.google.com/"
        }
      }
    ],
    "groupId": "",
    "id": "Redirect_a9qau",
    "isFavourite": false,
    "isSample": false,
    "lastModifiedBy": "IUAGkRiEx6XI0B6qCc82qbwroKX2",
    "modificationDate": 1735820120338,
    "name": "test",
    "objectType": "rule",
    "pairs": [
      {
        "destination": "https://www.bing.com/",
        "destinationType": "url",
        "id": "8id6k",
        "source": {
          "key": "Url",
          "operator": "Contains",
          "value": "https://www.google.com/"
        }
      }
    ],
    "ruleType": "Redirect",
    "schemaVersion": "3.0.0",
    "status": "Inactive"
  }
}

Response Codes

Status CodeDescription
200Rule retrieved successfully.
400Invalid rule pairs or payload.
401Unauthorized action.
404Rule or group not found.
429Too many requests.
I