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

# Check which tokens are valid

POST https://app.unleash-instance.example.com/edge/validate
Content-Type: application/json

This operation accepts a list of tokens to validate. Unleash will validate each token you provide. For each valid token you provide, Unleash will return the token along with its type and which projects it has access to.

Reference: https://docs.getunleash.io/api/get-valid-tokens

## Request

### Body (application/json)

- `tokens` (list of string, required) — Tokens that we want to get access information about

## Response

### 200

validatedEdgeTokensSchema

- `tokens` (list of object, required) — The list of Unleash token objects. Each object contains the token itself and some additional metadata.
  - `projects` (list of string, required) — The list of projects this token has access to. If the token has access to specific projects they will be listed here. If the token has access to all projects it will be represented as [`*`]
  - `environment` (string, required) — The environment this token as access to
  - `type` (enum, required) — The [API token](https://docs.getunleash.io/concepts/api-tokens-and-client-keys)'s **type**. Unleash supports three different types of API tokens ([ADMIN](https://docs.getunleash.io/concepts/api-tokens-and-client-keys#admin-tokens), [CLIENT](https://docs.getunleash.io/concepts/api-tokens-and-client-keys#backend-tokens), [FRONTEND](https://docs.getunleash.io/concepts/api-tokens-and-client-keys#frontend-tokens)). They all have varying access, so when validating a token it's important to know what kind you're dealing with
    - Allowed values: `client`, `admin`, `frontend`, `backend`
  - `token` (string, required) — The actual token value. [Unleash API tokens](https://docs.getunleash.io/concepts/api-tokens-and-client-keys) are comprised of three parts. \<project(s)>:\<environment>.randomcharacters

## Examples

**Request**

```json
{
  "tokens": [
    "aproject:development.randomstring",
    "[]:production.randomstring"
  ]
}
```

**Response**

```json
{
  "tokens": [
    {
      "projects": [
        "developerexperience",
        "enterprisegrowth"
      ],
      "environment": "development",
      "type": "client",
      "token": "*:development.5c806b5320c88cf27e81f3e9b97dab298a77d5879316e3c2d806206b"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://app.unleash-instance.example.com/edge/validate"

payload = { "tokens": ["aproject:development.randomstring", "[]:production.randomstring"] }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.unleash-instance.example.com/edge/validate';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"tokens":["aproject:development.randomstring","[]:production.randomstring"]}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.unleash-instance.example.com/edge/validate"

	payload := strings.NewReader("{\n  \"tokens\": [\n    \"aproject:development.randomstring\",\n    \"[]:production.randomstring\"\n  ]\n}")

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

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

	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://app.unleash-instance.example.com/edge/validate")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"tokens\": [\n    \"aproject:development.randomstring\",\n    \"[]:production.randomstring\"\n  ]\n}"

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://app.unleash-instance.example.com/edge/validate")
  .header("Content-Type", "application/json")
  .body("{\n  \"tokens\": [\n    \"aproject:development.randomstring\",\n    \"[]:production.randomstring\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.unleash-instance.example.com/edge/validate', [
  'body' => '{
  "tokens": [
    "aproject:development.randomstring",
    "[]:production.randomstring"
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://app.unleash-instance.example.com/edge/validate");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"tokens\": [\n    \"aproject:development.randomstring\",\n    \"[]:production.randomstring\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["tokens": ["aproject:development.randomstring", "[]:production.randomstring"]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/edge/validate")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```