Create a service token

Generates a new service token. **Note:** This is the only time you can get the Client Secret. If you lose the Client Secret, you will have to create a new service token.

/zones/{identifier}/access/service_tokens

post

Zone-Level Access service tokens

zone-level-access-service-tokens-create-a-service-token

Debug "planAvailability"

null

Debug "tokenPermissions"

null

Debug "parameters"

[
  {
    "in": "path",
    "name": "identifier",
    "required": true,
    "schema": {
      "description": "Identifier",
      "example": "023e105f4ecef8ad9ca31a8372d0c353",
      "maxLength": 32,
      "readOnly": true,
      "type": "string"
    }
  }
]

Debug "requestBody"

{
  "content": {
    "application/json": {
      "schema": {
        "properties": {
          "duration": {
            "description": "The duration for how long the service token will be valid. Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, h. The default is 1 year in hours (8760h).",
            "example": "60m",
            "type": "string"
          },
          "name": {
            "description": "The name of the service token.",
            "example": "CI/CD token",
            "type": "string"
          }
        },
        "required": [
          "name"
        ]
      }
    }
  },
  "required": true
}

Debug "responses"

{
  "201": {
    "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": [
                        {
                          "type": "object"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    }
                  }
                }
              ],
              "type": "object"
            },
            {
              "properties": {
                "result": {
                  "properties": {
                    "client_id": {
                      "description": "The Client ID for the service token. Access will check for this value in the `CF-Access-Client-ID` request header.",
                      "example": "88bf3b6d86161464f6509f7219099e57.access.example.com",
                      "type": "string"
                    },
                    "client_secret": {
                      "description": "The Client Secret for the service token. Access will check for this value in the `CF-Access-Client-Secret` request header.",
                      "example": "bdd31cbc4dec990953e39163fbbb194c93313ca9f0a6e420346af9d326b1d2a5",
                      "type": "string"
                    },
                    "created_at": {
                      "example": "2014-01-01T05:20:00.12345Z",
                      "format": "date-time",
                      "readOnly": true,
                      "type": "string"
                    },
                    "duration": {
                      "description": "The duration for how long the service token will be valid. Must be in the format `300ms` or `2h45m`. Valid time units are: ns, us (or µs), ms, s, m, h. The default is 1 year in hours (8760h).",
                      "example": "60m",
                      "type": "string"
                    },
                    "id": {
                      "description": "The ID of the service token."
                    },
                    "name": {
                      "description": "The name of the service token.",
                      "example": "CI/CD token",
                      "type": "string"
                    },
                    "updated_at": {
                      "example": "2014-01-01T05:20:00.12345Z",
                      "format": "date-time",
                      "readOnly": true,
                      "type": "string"
                    }
                  }
                }
              }
            }
          ]
        }
      }
    },
    "description": "Create a service token response"
  },
  "4XX": {
    "content": {
      "application/json": {
        "schema": {
          "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 a service token response failure"
  }
}

Debug "security"

[
  {
    "api_email": [],
    "api_key": []
  }
]