---
updatedAt: 2026-03-01T18:59:13.000Z
agentTools:
  siteIndex: https://techdocs.akamai.com/llms.txt
  projectIndex: https://techdocs.akamai.com/edgeworkers/llms.txt
---

# Create a secure token

Generate a JWT authentication token to [enable enhanced debug headers](doc:enable-enhanced-debug-headers) for EdgeWorkers.

# OpenAPI definition

```json
{
  "externalDocs": {
    "description": "See documentation for Akamai's EdgeWorkers API",
    "url": "https://techdocs.akamai.com/edgeworkers/reference"
  },
  "info": {
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "title": "Secure Token",
    "version": "v1"
  },
  "openapi": "3.0.0",
  "paths": {
    "/secure-token": {
      "post": {
        "description": "Generate a JWT authentication token to [enable enhanced debug headers](doc:enable-enhanced-debug-headers) for EdgeWorkers.",
        "externalDocs": {
          "description": "See documentation for this operation in Akamai's EdgeWorkers API",
          "url": "https://techdocs.akamai.com/edgeworkers/reference/post-secure-token"
        },
        "operationId": "post-secure-token",
        "parameters": [
          {
            "description": "For customers who manage more than one account, this [runs the operation from another account](https://techdocs.akamai.com/developer/docs/manage-many-accounts-with-one-api-client). The Identity and Access Management API provides a [list of available account switch keys](https://techdocs.akamai.com/iam-api/reference/get-client-account-switch-keys).",
            "in": "query",
            "name": "accountSwitchKey",
            "required": false,
            "schema": {
              "example": "1-5C0YLB:1-8BYUX",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "expiry": 30,
                "hostname": "www.hostname.com",
                "hostnames": [
                  "www.hostname1.com",
                  "www.hostname2.com"
                ],
                "propertyId": "123456789"
              },
              "schema": {
                "additionalProperties": false,
                "oneOf": [
                  {
                    "required": [
                      "hostname"
                    ],
                    "title": "hostname required"
                  },
                  {
                    "required": [
                      "hostnames"
                    ],
                    "title": "hostnames required"
                  },
                  {
                    "required": [
                      "propertyId"
                    ],
                    "title": "propertyId required"
                  }
                ],
                "properties": {
                  "expiry": {
                    "default": 480,
                    "description": "Number of minutes before the authentication token expires, from 1 to 720 minutes, or 12 hours. The default is `480` for 8 hours.",
                    "maximum": 720,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "hostname": {
                    "description": "__Deprecated__ Use `hostnames` instead. Hostname for a property. To create an authentication token, provide the `hostnames`, `hostname`, or `propertyId`.",
                    "minLength": 1,
                    "type": "string",
                    "x-akamai": {
                      "status": "DEPRECATED"
                    }
                  },
                  "hostnames": {
                    "description": "List of hostnames for a property. To create an authentication token, provide the `hostnames`, `hostname`, or `propertyId`. Specify `/*` to generate an authentication token valid for all hosts.",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "type": "array"
                  },
                  "propertyId": {
                    "description": "__Deprecated__ Use `hostnames` instead. Unique identifier for a property. To create an authentication token, provide the `hostnames`, `hostname`, or `propertyId`.",
                    "minLength": 1,
                    "type": "string",
                    "x-akamai": {
                      "status": "DEPRECATED"
                    }
                  }
                },
                "type": "object",
                "x-akamai": {
                  "file-path": "schemas/secure-token-post.yaml"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "example": {
                  "akamaiEwTrace": "eyJ0eXAiOiJKV1Qi ... iu1XOS9eJOl-54Yw"
                },
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "akamaiEwTrace": {
                      "description": "The JWT authentication token, for use with enhanced debug headers for EdgeWorkers.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "akamaiEwTrace"
                  ],
                  "type": "object",
                  "x-akamai": {
                    "file-path": "schemas/secure-token-200.yaml"
                  }
                }
              }
            },
            "description": "A generated JWT authentication token, for use with enhanced debug headers for EdgeWorkers. See [Enhanced debug headers](doc:enhanced-debug-header-details)."
          },
          "400": {
            "content": {
              "application/problem+json": {
                "example": {
                  "detail": "Host name provided does not exist in the property ",
                  "errorCode": "EW4807",
                  "instance": "f6d70100-9214-45d8-8a22-3974bb40db1f",
                  "status": 400,
                  "title": "Bad Request",
                  "type": "/edgeworkers/error-types/invalid-host-name"
                },
                "schema": {
                  "additionalProperties": false,
                  "description": "Error messaging.",
                  "properties": {
                    "detail": {
                      "description": "A description of the error.",
                      "type": "string"
                    },
                    "errorCode": {
                      "description": "Internal error code used to assist with troubleshooting by Akamai employees.",
                      "type": "string"
                    },
                    "instance": {
                      "description": "Reference to unique instance of the error.",
                      "type": "string"
                    },
                    "status": {
                      "description": "The HTTP code for the error.",
                      "type": "integer"
                    },
                    "title": {
                      "description": "Text representation of the HTTP error code.",
                      "type": "string"
                    },
                    "type": {
                      "description": "Reference to additional documentation.",
                      "type": "string"
                    }
                  },
                  "type": "object",
                  "x-akamai": {
                    "file-path": "schemas/error.yaml"
                  }
                }
              }
            },
            "description": "A specified hostname does not exist in the property."
          }
        },
        "summary": "Create a secure token",
        "tags": [
          "Secure tokens"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://{hostname}/edgeworkers/v1"
    }
  ],
  "x-akamai": {
    "auth-type": "EDGE_GRID",
    "file-path": "secure-token.yaml"
  },
  "x-readme": {
    "samples-languages": [
      "curl",
      "python",
      "node"
    ],
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```

# Sibling pages

* [Get a secure token](https://techdocs.akamai.com/edgeworkers/reference/get-secure-token.md)