> This page is for version V1 - End of support.
> For other versions, use one of these documentation indexes:
> - V3 - Beta (default): https://docs.authlyx.dev/v3/llms.txt
> - V2 - Legacy: https://docs.authlyx.dev/v2/llms.txt
> - V1 - End of support: https://docs.authlyx.dev/v1/llms.txt

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

# Variables

POST https://authly.cc/api/v1/variables
Content-Type: application/json

Archived request fields from the V1 variables handler. Consult your matching V1 SDK for field requirements and historical response handling.

Reference: https://docs.authlyx.dev/v1/api-reference/api-reference/v-1-variables

## Servers

- `https://authly.cc` (Existing production host, default)
- `https://api.authlyx.dev` (New API host - deployment pending)
- `http://127.0.0.1:4000` (Local compatibility API)

## Request

### Body (application/json)

This endpoint expects an object.

- `session_id` (string, optional)
- `var_key` (string, optional)
- `var_value` (string, optional)

## Response

### 200

V1 response. Check success and code; HTTP success alone is not authorization.

## Errors

### 400 Bad Request Error

Invalid request.

- `any`

### 401 Unauthorized Error

Invalid session or credentials.

- `any`

### 403 Forbidden Error

Access denied.

- `any`

### 429 Too Many Requests Error

Rate limit reached.

- `any`

## Examples

**Request**

```json
{
  "session_id": "c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140",
  "var_key": "MyApp",
  "var_value": "MyApp"
}
```

**Response**

```json
{}
```

**SDK Code**

```python v1_variables_example
import requests

url = "https://authly.cc/api/v1/variables"

payload = {
    "session_id": "c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140",
    "var_key": "MyApp",
    "var_value": "MyApp"
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript v1_variables_example
const url = 'https://authly.cc/api/v1/variables';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"session_id":"c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140","var_key":"MyApp","var_value":"MyApp"}'
};

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

```go v1_variables_example
package main

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

func main() {

	url := "https://authly.cc/api/v1/variables"

	payload := strings.NewReader("{\n  \"session_id\": \"c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140\",\n  \"var_key\": \"MyApp\",\n  \"var_value\": \"MyApp\"\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 v1_variables_example
require 'uri'
require 'net/http'

url = URI("https://authly.cc/api/v1/variables")

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  \"session_id\": \"c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140\",\n  \"var_key\": \"MyApp\",\n  \"var_value\": \"MyApp\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://authly.cc/api/v1/variables")
  .header("Content-Type", "application/json")
  .body("{\n  \"session_id\": \"c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140\",\n  \"var_key\": \"MyApp\",\n  \"var_value\": \"MyApp\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://authly.cc/api/v1/variables', [
  'body' => '{
  "session_id": "c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140",
  "var_key": "MyApp",
  "var_value": "MyApp"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp v1_variables_example
using RestSharp;

var client = new RestClient("https://authly.cc/api/v1/variables");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"session_id\": \"c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140\",\n  \"var_key\": \"MyApp\",\n  \"var_value\": \"MyApp\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift v1_variables_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "session_id": "c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140c7be084b6eaf9140",
  "var_key": "MyApp",
  "var_value": "MyApp"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://authly.cc/api/v1/variables")! 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()
```