Create Token

Create a new access token.

/user/tokens

post

User API Tokens

user-api-tokens-create-token

Debug "planAvailability"

{
  "business": true,
  "enterprise": true,
  "free": true,
  "pro": true
}

Debug "tokenPermissions"

{
  "enum": [
    "com.cloudflare.api.token.create"
  ]
}

Debug "parameters"

[]

Debug "requestBody"

{
  "content": {
    "application/json": {
      "schema": {
        "properties": {
          "condition": {
            "properties": {
              "request.ip": {
                "description": "Client IP restrictions.",
                "example": {
                  "in": [
                    "123.123.123.0/24",
                    "2606:4700::/32"
                  ],
                  "not_in": [
                    "123.123.123.100/24",
                    "2606:4700:4700::/48"
                  ]
                },
                "properties": {
                  "in": {
                    "description": "List of IPv4/IPv6 CIDR addresses.",
                    "example": [
                      "199.27.128.0/21",
                      "2400:cb00::/32"
                    ],
                    "items": {
                      "description": "IPv4/IPv6 CIDR.",
                      "example": "199.27.128.0/21",
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "not_in": {
                    "description": "List of IPv4/IPv6 CIDR addresses.",
                    "example": [
                      "199.27.128.0/21",
                      "2400:cb00::/32"
                    ],
                    "items": {
                      "description": "IPv4/IPv6 CIDR.",
                      "example": "199.27.128.0/21",
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "type": "object"
              }
            },
            "type": "object"
          },
          "expires_on": {
            "description": "The expiration time on or after which the JWT MUST NOT be accepted for processing.",
            "example": "2020-01-01T00:00:00Z",
            "format": "date-time",
            "type": "string"
          },
          "name": {
            "description": "Token name.",
            "example": "readonly token",
            "maxLength": 120,
            "type": "string"
          },
          "not_before": {
            "description": "The time before which the token MUST NOT be accepted for processing.",
            "example": "2018-07-01T05:20:00Z",
            "format": "date-time",
            "type": "string"
          },
          "policies": {
            "description": "List of access policies assigned to the token.",
            "items": {
              "oneOf": [
                {
                  "properties": {
                    "effect": {
                      "description": "Allow or deny operations against the resources.",
                      "enum": [
                        "allow",
                        "deny"
                      ],
                      "example": "allow",
                      "type": "string"
                    },
                    "id": {
                      "description": "Policy identifier.",
                      "example": "f267e341f3dd4697bd3b9f71dd96247f",
                      "readOnly": true,
                      "type": "string"
                    },
                    "permission_groups": {
                      "description": "A set of permission groups that are specified to the policy.",
                      "example": [
                        {
                          "id": "c8fed203ed3043cba015a93ad1616f1f",
                          "name": "Zone Read"
                        },
                        {
                          "id": "82e64a83756745bbbb1c9c2701bf816b",
                          "name": "DNS Read"
                        }
                      ],
                      "items": {
                        "description": "A named group of permissions that map to a group of operations against resources.",
                        "properties": {
                          "id": {
                            "description": "Identifier of the group.",
                            "example": "6d7f2f5f5b1d4a0e9081fdc98d432fd1",
                            "readOnly": true,
                            "type": "string"
                          },
                          "name": {
                            "description": "Name of the group.",
                            "example": "Load Balancers Write",
                            "readOnly": true,
                            "type": "string"
                          }
                        },
                        "required": [
                          "id"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "resources": {
                      "description": "A list of resource names that the policy applies to.",
                      "example": {
                        "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*",
                        "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*"
                      },
                      "type": "object"
                    }
                  },
                  "required": [
                    "id",
                    "effect",
                    "resources",
                    "permission_groups"
                  ],
                  "title": "policy_with_permission_groups"
                }
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "name",
          "policies"
        ],
        "type": "object"
      }
    }
  },
  "required": true
}

Debug "responses"

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "allOf": [
                {
                  "properties": {
                    "errors": {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    },
                    "messages": {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    },
                    "result": {
                      "anyOf": [
                        {
                          "type": "object"
                        },
                        {
                          "items": {},
                          "type": "array"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "success": {
                      "description": "Whether the API call was successful",
                      "enum": [
                        true
                      ],
                      "example": true,
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "success",
                    "errors",
                    "messages",
                    "result"
                  ],
                  "type": "object"
                },
                {
                  "properties": {
                    "result": {
                      "anyOf": [
                        {
                          "nullable": true,
                          "type": "object"
                        },
                        {
                          "nullable": true,
                          "type": "string"
                        }
                      ]
                    }
                  }
                }
              ],
              "type": "object"
            },
            {
              "properties": {
                "result": {
                  "allOf": [
                    {
                      "type": "object"
                    },
                    {
                      "properties": {
                        "value": {
                          "description": "The token value.",
                          "example": "8M7wS6hCpXVc-DoRnPPY_UCWPgy8aea4Wy6kCe5T",
                          "maxLength": 80,
                          "minLength": 40,
                          "readOnly": true,
                          "type": "string"
                        }
                      },
                      "type": "object"
                    }
                  ]
                }
              },
              "type": "object"
            }
          ]
        }
      }
    },
    "description": "Create Token response"
  },
  "4XX": {
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "allOf": [
                {
                  "allOf": [
                    {
                      "properties": {
                        "errors": {
                          "example": [],
                          "items": {
                            "properties": {
                              "code": {
                                "minimum": 1000,
                                "type": "integer"
                              },
                              "message": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "code",
                              "message"
                            ],
                            "type": "object",
                            "uniqueItems": true
                          },
                          "type": "array"
                        },
                        "messages": {
                          "example": [],
                          "items": {
                            "properties": {
                              "code": {
                                "minimum": 1000,
                                "type": "integer"
                              },
                              "message": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "code",
                              "message"
                            ],
                            "type": "object",
                            "uniqueItems": true
                          },
                          "type": "array"
                        },
                        "result": {
                          "anyOf": [
                            {
                              "type": "object"
                            },
                            {
                              "items": {},
                              "type": "array"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "success": {
                          "description": "Whether the API call was successful",
                          "enum": [
                            true
                          ],
                          "example": true,
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "success",
                        "errors",
                        "messages",
                        "result"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "result": {
                          "anyOf": [
                            {
                              "nullable": true,
                              "type": "object"
                            },
                            {
                              "nullable": true,
                              "type": "string"
                            }
                          ]
                        }
                      }
                    }
                  ],
                  "type": "object"
                },
                {
                  "properties": {
                    "result": {
                      "allOf": [
                        {
                          "type": "object"
                        },
                        {
                          "properties": {
                            "value": {
                              "description": "The token value.",
                              "example": "8M7wS6hCpXVc-DoRnPPY_UCWPgy8aea4Wy6kCe5T",
                              "maxLength": 80,
                              "minLength": 40,
                              "readOnly": true,
                              "type": "string"
                            }
                          },
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "type": "object"
                }
              ]
            },
            {
              "properties": {
                "errors": {
                  "allOf": [
                    {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    }
                  ],
                  "example": [
                    {
                      "code": 7003,
                      "message": "No route for the URI"
                    }
                  ],
                  "minLength": 1
                },
                "messages": {
                  "allOf": [
                    {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    }
                  ],
                  "example": []
                },
                "result": {
                  "enum": [
                    null
                  ],
                  "nullable": true,
                  "type": "object"
                },
                "success": {
                  "description": "Whether the API call was successful",
                  "enum": [
                    false
                  ],
                  "example": false,
                  "type": "boolean"
                }
              },
              "required": [
                "success",
                "errors",
                "messages",
                "result"
              ],
              "type": "object"
            }
          ]
        }
      }
    },
    "description": "Create Token response failure"
  }
}

Debug "security"

[
  {
    "api_token": []
  }
]