---
title: "Retrieves the collection of Draft rules"
method: GET
path: "/drafts"
tags: ["Draft"]
---

# Retrieves the collection of Draft rules

`GET /drafts`

This endpoint allows to retrieve the collection of draft rules of the project.
Draft rules represent changes that have been saved in the project but not yet published.
Each draft comes with a `status` property, which can be one of:
 * `add`: this is a new rule that is going to be added when publishing the ruleset
 * `update`: this is an already existing redirection rule that is going to be changed when publishing the ruleset
 * `delete`: this is an existing redirection rule that is going to be removed when publishing the ruleset

💡 Please note that there is pagination on this endpoint. Each page contain 100 items. Traversing the draft rules collection can be done using the `searchAfterId` query string parameter.

## Query parameters

- `projectId` string, required
- `searchAfterId` string
- `tags` string[]
- `enabled` boolean
- `triggerUrl` string

## Response `200`

Draft collection

- DraftJson[]
  - `id` string, required
  - `rule` DraftRuleJson, required
    - `actions` DraftAbstractActionJson[], required
      - union
        - object
          - `logEnabled` boolean, required
          - `reset` boolean, required
          - `stop` boolean, required
          - `type` 'configuration', required
        - object
          - `type` 'convertToMarkdown'
        - object
          - `action` 'append' | 'prepend' | 'replace' | 'remove' | 'after' | 'before', required — Where the HTML is inserted, relatively to the elements matched by the CSS selector.
          - `cssSelector` string, required — The CSS selector of the element the HTML is inserted relatively to.
          - `location` string, required
          - `type` 'customHtml', required
          - `value` string, required — The HTML to insert. Leave it out when the action is "remove".
        - object
          - `contentType` string, required
          - `type` 'customBody', required
          - `value` string, required
        - object
          - `statusCode` integer, required
          - `type` 'customStatus', required
        - object
          - `mode` 'override' | 'default' | 'replace' | 'add' | 'remove', required
          - `name` string, required
          - `override` boolean, nullable, required
          - `type` 'header', required
          - `value` string, required — The value of the header. Leave it out when the mode is "remove".
        - object
          - `location` string, required
          - `statusCode` 301 | 302 | 307 | 308, required
          - `type` 'redirection', required
        - object
          - `content` string, required
          - `type` 'robotsTxt', required
        - object
          - `name` 'title' | 'description' | 'keywords' | 'author' | 'og:title' | 'og:description' | 'og:type' | 'og:image' | 'og:url' | 'og:locale' | 'og:site_name' | 'canonical', required
          - `replace` boolean, required
          - `type` 'meta', required
          - `value` string, required
        - object
          - `content` string, required
          - `name` string, nullable, required
          - `type` 'sitemap', required
        - object
          - `type` 'structuredData', required
          - `value` string, required
        - object
          - `address` string, required
          - `allowInvalidCertificates` boolean, required
          - `requestHost` string, nullable, required
          - `sniHost` string, nullable, required
          - `tls` boolean, required
          - `type` 'switchBackend', required
    - `description` string, nullable, required — This description field is used to describe the rule and share knowledge with other users
    - `enabled` boolean, required — Set to `false` to disable this rule
    - `examples` DraftExampleJson[], required
      - `datetime` string, date-time, nullable, required
      - `headers` DraftHeader1Json[], required
        - `name` string, required
        - `value` string, required
      - `ipAddress` string, nullable, required
      - `method` string, nullable, required
      - `mustMatch` boolean, required
      - `responseBody` string, nullable, required
      - `responseHeaders` DraftHeader1Json[], required
        - `name` string, required
        - `value` string, required
      - `responseStatusCode` integer, nullable, required
      - `url` string, required
    - `id` string, required
    - `lastUsedAt` string, date-time, nullable, required — The date and time when this rule was last used to handle a request
    - `markers` DraftAbstractMarkerJson[], required
      - union
        - object
          - `description` string, nullable, required
          - `name` string, required
          - `template` object, nullable, required
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'anything', required
        - object
          - `description` string, nullable, required
          - `name` string, required
          - `regex` string, required
          - `template` object, nullable, required
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'custom', required
        - object
          - `description` string, nullable, required
          - `name` string, required
          - `template` object, nullable, required
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'date', required
        - object
          - `description` string, nullable, required
          - `name` string, required
          - `template` object, nullable, required
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'datetime', required
        - object
          - `description` string, nullable, required
          - `name` string, required
          - `template` object, nullable, required
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'enum', required
          - `values` string[], required
        - object
          - `description` string, nullable, required
          - `maximum` integer, nullable, required
          - `minimum` integer, nullable, required
          - `name` string, required
          - `template` object, nullable, required
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'integer', required
        - object
          - `allowDigits` boolean, required
          - `allowLowercaseAlphabet` boolean, required
          - `allowPercentEncodedChars` boolean, required
          - `allowUppercaseAlphabet` boolean, required
          - `containing` string, nullable, required
          - `description` string, nullable, required
          - `endingWith` string, nullable, required
          - `name` string, required
          - `specificCharacters` string[], required
          - `startingWith` string, nullable, required
          - `template` object, nullable, required
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'string', required
        - object
          - `description` string, nullable, required
          - `name` string, required
          - `template` object, nullable, required
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'uuid', required
    - `metadata` object, required
    - `priority` integer, required — A rule with higher priority takes precedence over lower priorities, which means that the actions defined in the higher priority rule will override the similar actions defined in a lower priority one
    - `tags` string[], required — Tags are useful to filter rules and retrieve them easily
    - `trigger` DraftTriggerJson, required
      - `date` DraftDateTriggerJson[], required
        - `operator` 'equals' | 'notEquals' | 'before' | 'after' | 'between' | 'notBetween' | 'weekdays', required — The operator with which the date will be compared.
        - `value` union, required — A date (for equals, notEquals, after or before operators), an array of two dates (for between or notBetween operators), or an array of integers (for weekdays operator, 0 for Sunday, 1 for Monday, and so on).
          - string, date-time
          - string[]
          - integer[]
      - `datetime` DraftDateTimeTriggerJson[], required
        - `operator` 'before' | 'after' | 'between' | 'notBetween', required — The operator with which the date and time will be compared.
        - `value` union, required — A datetime (for after and before operators), or an array of two datetimes (for between and notBetween operators).
          - string, date-time
          - string[]
      - `excludeMethods` boolean, required — Should the HTTP methods defined in methods be excluded from triggering the rule.
      - `excludeResponseStatusCodes` boolean, required — Should the response status codes defined in responseStatusCodes be excluded from triggering the rule.
      - `ipAddress` union, required
        - object
          - `ip` string, ipv4, required — The value of the request IP address to trigger this rule
          - `type` 'equals', required
        - object
          - `ip` string, ipv4, required — The value of the request IP address must be different to this value to trigger this rule
          - `type` 'notEquals', required
        - object
          - `ips` string[], required — The list the request IP address must be one of to trigger this rule
          - `type` 'oneOf', required
        - object
          - `ips` string[], required — The list the request IP address must be one of to trigger this rule
          - `type` 'notOneOf', required
        - object
          - `ip` string, ipv4, required — The minimum (excluded) value of the IP address of the request to trigger this rule
          - `type` 'greaterThan', required
        - object
          - `ip` string, ipv4, required — The minimum value of the IP address of the request to trigger this rule
          - `type` 'greaterThanOrEquals', required
        - object
          - `ip` string, ipv4, required — The minimum (excluded) value of the IP address of the request to trigger this rule
          - `type` 'lessThan', required
        - object
          - `ip` string, ipv4, required — The maximum value of the IP address of the request to trigger this rule
          - `type` 'lessThanOrEquals', required
        - object
          - `end` string, ipv4, required — The upper (included) bound of the IP range to which the request IP address must belong to trigger this rule
          - `start` string, ipv4, required — The lower (included) bound of the IP range to which the request IP address must belong to trigger this rule
          - `type` 'inRange', required
        - object
          - `end` string, ipv4, required — The upper (included) bound of the IP range to which the request IP address must not belong to trigger this rule
          - `start` string, ipv4, required — The lower (included) bound of the IP range to which the request IP address must not belong to trigger this rule
          - `type` 'notInRange', required
      - `methods` string[], required
      - `requestHeaders` DraftHeaderJson[], required
        - `name` string, required — The operator with which the value will be compared
        - `operator` 'isDefined' | 'isNotDefined' | 'equals' | 'isNotEqualTo' | 'contains' | 'doesNotContain' | 'endsWith' | 'startsWith' | 'matchesRegex', required — The name of the request HTTP header
        - `value` string, nullable, required
      - `responseStatusCodes` integer[], required — The backend response status code(s) that must trigger the rule
      - `sampling` integer, nullable, required — The percentage of requests that must trigger the rule
      - `source` string, required — The URL to redirect from.
      - `time` DraftTimeTriggerJson[], required
        - `operator` 'before' | 'after' | 'between' | 'notBetween', required — The operator with which the time will be compared.
        - `value` union, required — A time (for after and before operators), or an array of two time (for between and notBetween operators).
          - string, date-time
          - string[]
    - `usageCount` integer, required — The total number of times this rule has been used to handle a request
    - `variables` DraftAbstractVariableJson[], required
      - union
        - object
          - `marker` string, required — The name of the trigger marker to associate with this variable
          - `name` string, required — The name of the variable as it must appear in actions
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'marker', required
        - object
          - `defaultValue` string, nullable, required
          - `headerName` string, required
          - `name` string, required — The name of the variable as it must appear in actions
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'requestHeader', required
        - object
          - `name` string, required — The name of the variable as it must appear in actions
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'requestHost', required
        - object
          - `name` string, required — The name of the variable as it must appear in actions
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'requestMethod', required
        - object
          - `name` string, required — The name of the variable as it must appear in actions
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'requestPath', required
        - object
          - `name` string, required — The name of the variable as it must appear in actions
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'requestRemoteAddress', required
        - object
          - `name` string, required — The name of the variable as it must appear in actions
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'requestScheme', required
        - object
          - `name` string, required — The name of the variable as it must appear in actions
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'requestTime', required
        - object
          - `default` string, nullable, required
          - `name` string, required — The name of the variable as it must appear in actions
          - `selector` string, required
          - `transformers` DraftAbstractTransformerJson[], required
            - union
              - …
          - `type` 'bodyHtml', required
  - `status` 'add' | 'update' | 'delete', required — The type of change that this draft represents.

---

[API](https://skmtc.net/redirection/apis/redirection-io.md) · [All operations](https://skmtc.net/redirection/apis/redirection-io/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/redirection/redirection-io/versions/50d19e1f364a/schema)
