> For a complete page index, fetch https://docs.synthflow.ai/llms.txt. For full documentation content, fetch https://docs.synthflow.ai/llms-full.txt.

# Authentication

> Generate a Synthflow API key, send it with Bearer authentication, and follow basic key-management practices.

The Synthflow API relies on API keys for every request. You can create and manage keys in **Admin** → **Workspace Settings** → **API Keys** as long as your [user role](/user-management#roles) allows it.

**Keep your key secret.** Do not embed it in public repos, client-side code, or shared screenshots. Store it in an environment variable or a secrets manager and inject it at runtime.

All requests must include the key using HTTP Bearer authentication:

```bash
curl https://api.synthflow.ai/v2/assistants \ 
  -H "Authorization: Bearer $SYNTHFLOW_API_KEY"
```

Rotate keys periodically and delete any that are no longer in use to reduce exposure.

## Generate an API key

1. Sign in to your Synthflow workspace at [synthflow.ai](https://synthflow.ai/).
2. Open **Admin** → **Workspace Settings** → **API Keys**.
3. Click **Create new API key**, copy the value, and store it securely.
4. Use the key in your requests as shown above.

## Verify your key

Confirm your key works by running a read-only request. The [List agents](/api-reference/platform-api/agents/list-assistant) endpoint takes no required parameters, so a successful response means your key is valid. Paste your key as a Bearer token and run it.

### Request

GET [https://api.synthflow.ai/v2/assistants/](https://api.synthflow.ai/v2/assistants/)

```curl
curl https://api.synthflow.ai/v2/assistants/ \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json"
```

```python
import requests

url = "https://api.synthflow.ai/v2/assistants/"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```go
package main

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

func main() {

	url := "https://api.synthflow.ai/v2/assistants/"

	payload := strings.NewReader("{}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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://api.synthflow.ai/v2/assistants/")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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.get("https://api.synthflow.ai/v2/assistants/")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.synthflow.ai/v2/assistants/");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.synthflow.ai/v2/assistants/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
```