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

# Generate auth token

GET https://api.murf.ai/v1/auth/token

Generates an auth token for authenticating your requests

Reference: https://murf.ai/api/docs/api-reference/authentication/generate-token

## Request

### Headers

- `api-key` (string, required)

## Response

### 200

Ok

- `expiryInEpochMillis` (long, optional) — The timestamp at which the generated token will expire - in Unix time.
- `token` (string, optional)

## Errors

### 400 Bad Request Error

Bad request or missing api-key header

- `any`

### 401 Unauthorized Error

Bad api-key provided

- `any`

### 503 Service Unavailable Error

Service Unavailable

- `any`

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "expiryInEpochMillis": 1711929600000,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyQGV4YW1wbGUuY29tIiwiaWF0IjoxNjgyNjQwMDAwLCJleHAiOjE3MTE5Mjk2MDB9.4fG7X9vJq3ZxY2v8Q9WzL1aT5bN6cR0p"
}
```

**SDK Code**

```python
import requests

url = "https://api.murf.ai/v1/auth/token"

payload = {}
headers = {
    "api-key": "api-key",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.murf.ai/v1/auth/token';
const options = {
  method: 'GET',
  headers: {'api-key': 'api-key', 'Content-Type': 'application/json'},
  body: '{}'
};

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://api.murf.ai/v1/auth/token"

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

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

	req.Header.Add("api-key", "api-key")
	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.murf.ai/v1/auth/token")

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

request = Net::HTTP::Get.new(url)
request["api-key"] = 'api-key'
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.murf.ai/v1/auth/token")
  .header("api-key", "api-key")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.murf.ai/v1/auth/token', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'api-key' => 'api-key',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.murf.ai/v1/auth/token");
var request = new RestRequest(Method.GET);
request.AddHeader("api-key", "api-key");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "api-key": "api-key",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.murf.ai/v1/auth/token")! 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()
```