> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://akamai.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://akamai.ferndocs.com/_mcp/server.

# Validate an EdgeWorkers code bundle

POST https://{hostname}/edgeworkers/v1/validations
Content-Type: application/gzip

Return a list of errors and warnings containing details on how to fix your code bundle. See [Validation types](https://techdocs.akamai.com/edgeworkers/reference/validation-types). In order to run this operation you need to provide an EdgeWorkers code bundle as a GZIP binary file in the request body, with a `Content-Type` of `application/gzip`.

Reference: https://akamai.ferndocs.com/edge-workers/api/edge-workers-api/validations/post-validations

## Request

### Query parameters

- `accountSwitchKey` (string, optional) — 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).

### Body (application/gzip)

This endpoint expects binary data of type application/gzip.

- Binary request body.

## Response

### 200

Provides details for an EdgeWorkers code bundle validation.

- `errors` (list of ValidationsPostResponsesContentApplicationJsonSchemaErrorsItems, required) — List of validation errors.
- `warnings` (list of ValidationsPostResponsesContentApplicationJsonSchemaWarningsItems, required) — List of validation warnings.

## Types

### ValidationsPostResponsesContentApplicationJsonSchemaErrorsItems

Provides details for an EdgeWorker code bundle validation error.

- `message` (string, required) — Message containing more details about the validation error.
- `type` (enum, required) — The type of the validation error. See [Validation error types](https://techdocs.akamai.com/edgeworkers/reference/validation-types).
  - Allowed values: `ACCESS_TOKEN_EXPIRED`, `ACCESS_TOKEN_INVALID`, `ACCESS_TOKEN_MISSING`, `EDGEKV_FILE_MISSING`, `EDGEKV_TOKENS_FILE_MISSING`, `EMPTY_TARBALL`, `INVALID_EDGEKV_IMPORTS`, `INVALID_GZIP_FORMAT`, `INVALID_MANIFEST`, `INVALID_TAR_ARCHIVE`, `MAX_COMPRESSED_SIZE_EXCEEDED`, `MAX_UNCOMPRESSED_SIZE_EXCEEDED`, `MISSING_MANDATORY_FILES`, `STATIC_VALIDATION_FAILED`, `DEPENDENCY_NOT_FOUND`, `MISSING_MEGABUNDLE_JSON_FILE`, `MISSING_DEPENDENCIES_DIRECTORY`, `INVALID_MEGABUNDLE_JSON_FILE`

### ValidationsPostResponsesContentApplicationJsonSchemaWarningsItems

Provides details for an EdgeWorker code bundle validation warning.

- `message` (string, required) — Message containing more details about the validation warning.
- `type` (enum, required) — The type of the validation warning. See [Validation warning types](https://techdocs.akamai.com/edgeworkers/reference/validation-types).
  - Allowed values: `ACCESS_TOKEN_EXPIRING_SOON`

## Examples

**Response**

```json
{
  "errors": [
    {
      "message": "static validation failed : main.js::9:16 SyntaxError: Unexpected identifier.",
      "type": "STATIC_VALIDATION_FAILED"
    },
    {
      "message": "manifest file is invalid",
      "type": "INVALID_MANIFEST"
    }
  ],
  "warnings": [
    {
      "message": "The EdgeKV access token is still valid but will expire soon.",
      "type": "ACCESS_TOKEN_EXPIRING_SOON"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://{hostname}/edgeworkers/v1/validations"

querystring = {"accountSwitchKey":"{{accountSwitchKey}}"}

headers = {"Content-Type": "application/gzip"}

response = requests.post(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://{hostname}/edgeworkers/v1/validations?accountSwitchKey=%7B%7BaccountSwitchKey%7D%7D';
const options = {method: 'POST', headers: {'Content-Type': 'application/gzip'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://{hostname}/edgeworkers/v1/validations?accountSwitchKey=%7B%7BaccountSwitchKey%7D%7D"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Content-Type", "application/gzip")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://{hostname}/edgeworkers/v1/validations?accountSwitchKey=%7B%7BaccountSwitchKey%7D%7D")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/gzip'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://{hostname}/edgeworkers/v1/validations?accountSwitchKey=%7B%7BaccountSwitchKey%7D%7D")
  .header("Content-Type", "application/gzip")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://{hostname}/edgeworkers/v1/validations?accountSwitchKey=%7B%7BaccountSwitchKey%7D%7D', [
  'headers' => [
    'Content-Type' => 'application/gzip',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://{hostname}/edgeworkers/v1/validations?accountSwitchKey=%7B%7BaccountSwitchKey%7D%7D");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/gzip");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/gzip"]

let request = NSMutableURLRequest(url: NSURL(string: "https://{hostname}/edgeworkers/v1/validations?accountSwitchKey=%7B%7BaccountSwitchKey%7D%7D")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```