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

# Issue Access Token

POST https://api.vitablehealth.com/v1/auth/access-tokens
Content-Type: application/json

Issues a short-lived access token from the authenticated API key. Access tokens can optionally be bound to a specific employer or employee for scoped access. Tokens expire after 15 minutes.

Reference: https://developer.vitablehealth.com/api/auth/issue-access-token

## Authentication

- `Authorization` header (bearer token, required) — API Key or Access Token authentication using Bearer token in Authorization header. API keys use the vit_apk_ prefix, access tokens use the vit_at_ prefix.

## Servers

- `https://api.vitablehealth.com` (Production, default)
- `https://api.uat.vitablehealth.com` (UAT)

## Request

### Body (application/json)

This endpoint expects an IssueAccessTokenRequest.

- `grant_type` (enum, required) — Token issuance flow. Currently only 'client_credentials' supported. * `client_credentials` - client_credentials
  - Allowed values: `client_credentials`
- `bound_entity` (BoundEntity, optional, nullable) — Optional entity to bind the token to for scoped access

## Response

### 200

- `access_token` (string, required) — The issued access token (vit_at_*)
- `token_type` (string, required) — Token type, always 'Bearer'
- `expires_in` (integer, required) — Token lifetime in seconds
- `bound_entity` (BoundEntityResponse, optional, nullable) — Entity the token is bound to, if any

## Errors

### 400 Bad Request Error

Bad Request - Invalid input or validation error

- `timestamp` (datetime, required) — ISO 8601 timestamp when the error occurred
- `message` (string, required) — Human-readable error message
- `error` (string, required) — Error message (same as message, for backwards compatibility)
- `trace_id` (string, required) — Unique trace ID for debugging and support requests
- `app_error_code` (string, optional, nullable) — Application-specific error code for programmatic handling

### 401 Unauthorized Error

Unauthorized - Invalid or missing API key

- `timestamp` (datetime, required) — ISO 8601 timestamp when the error occurred
- `message` (string, required) — Human-readable error message
- `error` (string, required) — Error message (same as message, for backwards compatibility)
- `trace_id` (string, required) — Unique trace ID for debugging and support requests
- `app_error_code` (string, optional, nullable) — Application-specific error code for programmatic handling

### 403 Forbidden Error

Forbidden - Insufficient permissions for this resource

- `timestamp` (datetime, required) — ISO 8601 timestamp when the error occurred
- `message` (string, required) — Human-readable error message
- `error` (string, required) — Error message (same as message, for backwards compatibility)
- `trace_id` (string, required) — Unique trace ID for debugging and support requests
- `app_error_code` (string, optional, nullable) — Application-specific error code for programmatic handling

### 404 Not Found Error

Not Found - The requested resource does not exist

- `timestamp` (datetime, required) — ISO 8601 timestamp when the error occurred
- `message` (string, required) — Human-readable error message
- `error` (string, required) — Error message (same as message, for backwards compatibility)
- `trace_id` (string, required) — Unique trace ID for debugging and support requests
- `app_error_code` (string, optional, nullable) — Application-specific error code for programmatic handling

### 409 Conflict Error

Conflict - Resource already exists or conflicts with current state

- `timestamp` (datetime, required) — ISO 8601 timestamp when the error occurred
- `message` (string, required) — Human-readable error message
- `error` (string, required) — Error message (same as message, for backwards compatibility)
- `trace_id` (string, required) — Unique trace ID for debugging and support requests
- `app_error_code` (string, optional, nullable) — Application-specific error code for programmatic handling

### 429 Too Many Requests Error

Too Many Requests - Rate limit exceeded

- `timestamp` (datetime, required) — ISO 8601 timestamp when the error occurred
- `message` (string, required) — Human-readable error message
- `error` (string, required) — Error message (same as message, for backwards compatibility)
- `trace_id` (string, required) — Unique trace ID for debugging and support requests
- `app_error_code` (string, optional, nullable) — Application-specific error code for programmatic handling

### 500 Internal Server Error

Internal Server Error - An unexpected error occurred

- `timestamp` (datetime, required) — ISO 8601 timestamp when the error occurred
- `message` (string, required) — Human-readable error message
- `error` (string, required) — Error message (same as message, for backwards compatibility)
- `trace_id` (string, required) — Unique trace ID for debugging and support requests
- `app_error_code` (string, optional, nullable) — Application-specific error code for programmatic handling

### 502 Bad Gateway Error

Bad Gateway - External service error

- `timestamp` (datetime, required) — ISO 8601 timestamp when the error occurred
- `message` (string, required) — Human-readable error message
- `error` (string, required) — Error message (same as message, for backwards compatibility)
- `trace_id` (string, required) — Unique trace ID for debugging and support requests
- `app_error_code` (string, optional, nullable) — Application-specific error code for programmatic handling

## Types

### BoundEntity

- `id` (string, required) — Prefixed entity ID to bind the token to (empr_* for employer, empl_* for employee)
- `type` (enum, required) — Type of entity: 'employer' or 'employee' * `employer` - employer * `employee` - employee
  - Allowed values: `employer`, `employee`

### BoundEntityResponse

- `id` (string, required) — Prefixed entity ID the token is bound to (empr_* or empl_*)
- `type` (enum, required) — Type of bound entity * `employer` - employer * `employee` - employee
  - Allowed values: `employer`, `employee`

## Examples

### Access Token Response

**Response**

```json
{
  "access_token": "vit_at_abc123def456...",
  "token_type": "Bearer",
  "expires_in": 910,
  "bound_entity": {
    "id": "empr_SGVsbG8gV29ybGQ",
    "type": "employer"
  }
}
```

**SDK Code**

```python Access Token Response
import requests

url = "https://api.vitablehealth.com/v1/auth/access-tokens"

headers = {"Authorization": "Bearer <apiKey>"}

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

print(response.json())
```

```javascript Access Token Response
const url = 'https://api.vitablehealth.com/v1/auth/access-tokens';
const options = {method: 'POST', headers: {Authorization: 'Bearer <apiKey>'}};

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

```go Access Token Response
package main

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

func main() {

	url := "https://api.vitablehealth.com/v1/auth/access-tokens"

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

	req.Header.Add("Authorization", "Bearer <apiKey>")

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

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

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

}
```

```ruby Access Token Response
require 'uri'
require 'net/http'

url = URI("https://api.vitablehealth.com/v1/auth/access-tokens")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'

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

```java Access Token Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.vitablehealth.com/v1/auth/access-tokens")
  .header("Authorization", "Bearer <apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.vitablehealth.com/v1/auth/access-tokens', [
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
  ],
]);

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

```csharp Access Token Response
using RestSharp;

var client = new RestClient("https://api.vitablehealth.com/v1/auth/access-tokens");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Access Token Response
import Foundation

let headers = ["Authorization": "Bearer <apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.vitablehealth.com/v1/auth/access-tokens")! 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()
```

### Unbound Token Request

**Request**

```json
{
  "grant_type": "client_credentials"
}
```

**Response**

```json
{
  "access_token": "vit_at_abc123def456...",
  "token_type": "Bearer",
  "expires_in": 910,
  "bound_entity": {
    "id": "empr_SGVsbG8gV29ybGQ",
    "type": "employer"
  }
}
```

**SDK Code**

```python Unbound Token Request
import requests

url = "https://api.vitablehealth.com/v1/auth/access-tokens"

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

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

print(response.json())
```

```javascript Unbound Token Request
const url = 'https://api.vitablehealth.com/v1/auth/access-tokens';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"grant_type":"client_credentials"}'
};

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

```go Unbound Token Request
package main

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

func main() {

	url := "https://api.vitablehealth.com/v1/auth/access-tokens"

	payload := strings.NewReader("{\n  \"grant_type\": \"client_credentials\"\n}")

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

	req.Header.Add("Authorization", "Bearer <apiKey>")
	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 Unbound Token Request
require 'uri'
require 'net/http'

url = URI("https://api.vitablehealth.com/v1/auth/access-tokens")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"grant_type\": \"client_credentials\"\n}"

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

```java Unbound Token Request
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.vitablehealth.com/v1/auth/access-tokens")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"grant_type\": \"client_credentials\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.vitablehealth.com/v1/auth/access-tokens', [
  'body' => '{
  "grant_type": "client_credentials"
}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Unbound Token Request
using RestSharp;

var client = new RestClient("https://api.vitablehealth.com/v1/auth/access-tokens");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"grant_type\": \"client_credentials\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Unbound Token Request
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.vitablehealth.com/v1/auth/access-tokens")! 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()
```

### Employer-Bound Token Request

**Request**

```json
{
  "grant_type": "client_credentials",
  "bound_entity": {
    "id": "empr_SGVsbG8gV29ybGQ",
    "type": "employer"
  }
}
```

**Response**

```json
{
  "access_token": "vit_at_abc123def456...",
  "token_type": "Bearer",
  "expires_in": 910,
  "bound_entity": {
    "id": "empr_SGVsbG8gV29ybGQ",
    "type": "employer"
  }
}
```

**SDK Code**

```python Employer-Bound Token Request
import requests

url = "https://api.vitablehealth.com/v1/auth/access-tokens"

payload = {
    "grant_type": "client_credentials",
    "bound_entity": {
        "id": "empr_SGVsbG8gV29ybGQ",
        "type": "employer"
    }
}
headers = {
    "Authorization": "Bearer <apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Employer-Bound Token Request
const url = 'https://api.vitablehealth.com/v1/auth/access-tokens';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <apiKey>', 'Content-Type': 'application/json'},
  body: '{"grant_type":"client_credentials","bound_entity":{"id":"empr_SGVsbG8gV29ybGQ","type":"employer"}}'
};

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

```go Employer-Bound Token Request
package main

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

func main() {

	url := "https://api.vitablehealth.com/v1/auth/access-tokens"

	payload := strings.NewReader("{\n  \"grant_type\": \"client_credentials\",\n  \"bound_entity\": {\n    \"id\": \"empr_SGVsbG8gV29ybGQ\",\n    \"type\": \"employer\"\n  }\n}")

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

	req.Header.Add("Authorization", "Bearer <apiKey>")
	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 Employer-Bound Token Request
require 'uri'
require 'net/http'

url = URI("https://api.vitablehealth.com/v1/auth/access-tokens")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"grant_type\": \"client_credentials\",\n  \"bound_entity\": {\n    \"id\": \"empr_SGVsbG8gV29ybGQ\",\n    \"type\": \"employer\"\n  }\n}"

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

```java Employer-Bound Token Request
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.vitablehealth.com/v1/auth/access-tokens")
  .header("Authorization", "Bearer <apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"grant_type\": \"client_credentials\",\n  \"bound_entity\": {\n    \"id\": \"empr_SGVsbG8gV29ybGQ\",\n    \"type\": \"employer\"\n  }\n}")
  .asString();
```

```php Employer-Bound Token Request
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.vitablehealth.com/v1/auth/access-tokens', [
  'body' => '{
  "grant_type": "client_credentials",
  "bound_entity": {
    "id": "empr_SGVsbG8gV29ybGQ",
    "type": "employer"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Employer-Bound Token Request
using RestSharp;

var client = new RestClient("https://api.vitablehealth.com/v1/auth/access-tokens");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"grant_type\": \"client_credentials\",\n  \"bound_entity\": {\n    \"id\": \"empr_SGVsbG8gV29ybGQ\",\n    \"type\": \"employer\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Employer-Bound Token Request
import Foundation

let headers = [
  "Authorization": "Bearer <apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "grant_type": "client_credentials",
  "bound_entity": [
    "id": "empr_SGVsbG8gV29ybGQ",
    "type": "employer"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.vitablehealth.com/v1/auth/access-tokens")! 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()
```