Profile API

Manage your account preferences and API keys. Use the preferences endpoints to configure timezone, language, and theme settings. Use the API keys endpoints to create, list, regenerate, and revoke access tokens for programmatic access.

Preferences

GET /v1/profile/preferences Requires Auth

Get Preferences

Get Preferences

Retrieve the authenticated user's account preferences including timezone, language, and theme settings.

curl https://api.proxyhat.com/v1/profile/preferences \
  -H "Authorization: Bearer __API_KEY__" \
  -H "Accept: application/json"
import requests

response = requests.get(
    "https://api.proxyhat.com/v1/profile/preferences",
    headers={
        "Authorization": "Bearer __API_KEY__",
        "Accept": "application/json",
    },
)

prefs = response.json()["payload"]
print(f"Timezone: {prefs[\"timezone\"]}, Theme: {prefs[\"theme\"]}")
const response = await fetch("https://api.proxyhat.com/v1/profile/preferences", {
  headers: {
    "Authorization": "Bearer __API_KEY__",
    "Accept": "application/json",
  },
});

const { payload: prefs } = await response.json();
console.log(`Timezone: ${prefs.timezone}, Theme: ${prefs.theme}`);
req, _ := http.NewRequest("GET", "https://api.proxyhat.com/v1/profile/preferences", nil)
req.Header.Set("Authorization", "Bearer __API_KEY__")
req.Header.Set("Accept", "application/json")

resp, err := http.DefaultClient.Do(req)
if err != nil {
    log.Fatal(err)
}
defer resp.Body.Close()

var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["payload"])
Response 200
{
  "success": true,
  "payload": {
    "timezone": "UTC",
    "language": "en",
    "theme": "dark"
  }
}
PUT /v1/profile/preferences Requires Auth

Update Preferences

Update Preferences

Update the authenticated user's account preferences. Only the fields you include in the request body will be updated; omitted fields remain unchanged.

Request Body
Name Type Required Description
timezone string Optional An IANA timezone identifier (e.g. "America/New_York", "Europe/London", "UTC").
language string Optional Preferred language code (e.g. "en", "ru").
theme string Optional UI theme preference: "light" or "dark".
curl -X PUT https://api.proxyhat.com/v1/profile/preferences \
  -H "Authorization: Bearer __API_KEY__" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "timezone": "America/New_York",
    "language": "en"
  }'
import requests

response = requests.put(
    "https://api.proxyhat.com/v1/profile/preferences",
    headers={
        "Authorization": "Bearer __API_KEY__",
        "Content-Type": "application/json",
        "Accept": "application/json",
    },
    json={
        "timezone": "America/New_York",
        "language": "en",
    },
)

prefs = response.json()["payload"]
print(f"Updated timezone: {prefs[\"timezone\"]}")
const response = await fetch("https://api.proxyhat.com/v1/profile/preferences", {
  method: "PUT",
  headers: {
    "Authorization": "Bearer __API_KEY__",
    "Content-Type": "application/json",
    "Accept": "application/json",
  },
  body: JSON.stringify({
    timezone: "America/New_York",
    language: "en",
  }),
});

const { payload: prefs } = await response.json();
console.log(`Updated timezone: ${prefs.timezone}`);
payload := strings.NewReader(`{
  "timezone": "America/New_York",
  "language": "en"
}`)

req, _ := http.NewRequest("PUT", "https://api.proxyhat.com/v1/profile/preferences", payload)
req.Header.Set("Authorization", "Bearer __API_KEY__")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json")

resp, err := http.DefaultClient.Do(req)
if err != nil {
    log.Fatal(err)
}
defer resp.Body.Close()

var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["payload"])
Response 200
{
  "success": true,
  "payload": {
    "timezone": "America/New_York",
    "language": "en",
    "theme": "dark"
  }
}

API Keys

GET /v1/profile/api-keys Requires Auth

List API Keys

List API Keys

Retrieve all API keys associated with the authenticated account. Returns key metadata including name, creation date, last usage, and abilities. The plain-text token value is not included.

curl https://api.proxyhat.com/v1/profile/api-keys \
  -H "Authorization: Bearer __API_KEY__" \
  -H "Accept: application/json"
import requests

response = requests.get(
    "https://api.proxyhat.com/v1/profile/api-keys",
    headers={
        "Authorization": "Bearer __API_KEY__",
        "Accept": "application/json",
    },
)

keys = response.json()
for key in keys:
    print(f"{key[\"name\"]} — last used: {key[\"last_used_at\"]}")
const response = await fetch("https://api.proxyhat.com/v1/profile/api-keys", {
  headers: {
    "Authorization": "Bearer __API_KEY__",
    "Accept": "application/json",
  },
});

const keys = await response.json();
keys.forEach(k => console.log(`${k.name} — last used: ${k.last_used_at}`));
req, _ := http.NewRequest("GET", "https://api.proxyhat.com/v1/profile/api-keys", nil)
req.Header.Set("Authorization", "Bearer __API_KEY__")
req.Header.Set("Accept", "application/json")

resp, err := http.DefaultClient.Do(req)
if err != nil {
    log.Fatal(err)
}
defer resp.Body.Close()

var keys []map[string]interface{}
json.NewDecoder(resp.Body).Decode(&keys)
for _, k := range keys {
    fmt.Printf("%s — last used: %s\n", k["name"], k["last_used_at"])
}
Response 200
[
  {
    "id": 1,
    "name": "My API Key",
    "created_at": "2026-01-21T10:30:00Z",
    "last_used_at": "2026-01-21T15:45:00Z",
    "abilities": ["*"]
  }
]
POST /v1/profile/api-keys Requires Auth

Create API Key

Create API Key

Create a new API key for the authenticated account. The response includes the plain-text token value which you must store securely — it cannot be retrieved again after this response.

Request Body
Name Type Required Description
name string Optional A friendly name to identify the key (e.g. "Production Key", "CI/CD"). Defaults to "My API Key" if omitted.
curl -X POST https://api.proxyhat.com/v1/profile/api-keys \
  -H "Authorization: Bearer __API_KEY__" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "name": "Production Key"
  }'
import requests

response = requests.post(
    "https://api.proxyhat.com/v1/profile/api-keys",
    headers={
        "Authorization": "Bearer __API_KEY__",
        "Content-Type": "application/json",
        "Accept": "application/json",
    },
    json={
        "name": "Production Key",
    },
)

key = response.json()
# Store this token securely — it will not be shown again
print(f"Token: {key[\"plain_text_token\"]}")
const response = await fetch("https://api.proxyhat.com/v1/profile/api-keys", {
  method: "POST",
  headers: {
    "Authorization": "Bearer __API_KEY__",
    "Content-Type": "application/json",
    "Accept": "application/json",
  },
  body: JSON.stringify({
    name: "Production Key",
  }),
});

const key = await response.json();
// Store this token securely — it will not be shown again
console.log(`Token: ${key.plain_text_token}`);
payload := strings.NewReader(`{
  "name": "Production Key"
}`)

req, _ := http.NewRequest("POST", "https://api.proxyhat.com/v1/profile/api-keys", payload)
req.Header.Set("Authorization", "Bearer __API_KEY__")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json")

resp, err := http.DefaultClient.Do(req)
if err != nil {
    log.Fatal(err)
}
defer resp.Body.Close()

var key map[string]interface{}
json.NewDecoder(resp.Body).Decode(&key)
// Store this token securely — it will not be shown again
fmt.Println("Token:", key["plain_text_token"])
Response 200
{
  "id": 2,
  "name": "My API Key",
  "plain_text_token": "2|abc123xyz...",
  "created_at": "2026-01-21T10:30:00Z"
}
Important: The plain_text_token value is only returned once at creation time. Store it in a secure location immediately. If you lose it, you will need to regenerate the key to obtain a new token.
DELETE /v1/profile/api-keys/{id} Requires Auth

Delete API Key

Delete API Key

Permanently revoke and delete an API key by its ID. Any requests using this key's token will immediately stop working.

Path Parameters
Name Type Required Description
id integer Required The ID of the API key to delete.
curl -X DELETE https://api.proxyhat.com/v1/profile/api-keys/1 \
  -H "Authorization: Bearer __API_KEY__" \
  -H "Accept: application/json"
import requests

key_id = 1

response = requests.delete(
    f"https://api.proxyhat.com/v1/profile/api-keys/{key_id}",
    headers={
        "Authorization": "Bearer __API_KEY__",
        "Accept": "application/json",
    },
)

result = response.json()
print(result["message"])
const keyId = 1;

const response = await fetch(`https://api.proxyhat.com/v1/profile/api-keys/${keyId}`, {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer __API_KEY__",
    "Accept": "application/json",
  },
});

const result = await response.json();
console.log(result.message);
keyID := 1
url := fmt.Sprintf("https://api.proxyhat.com/v1/profile/api-keys/%d", keyID)

req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Set("Authorization", "Bearer __API_KEY__")
req.Header.Set("Accept", "application/json")

resp, err := http.DefaultClient.Do(req)
if err != nil {
    log.Fatal(err)
}
defer resp.Body.Close()

var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["message"])
Response 200
{
  "message": "Deleted"
}
POST /v1/profile/api-keys/{id}/regenerate Requires Auth

Regenerate API Key

Regenerate API Key

Regenerate an existing API key. The old token is immediately revoked and a new plain-text token is returned. Store the new token securely — it cannot be retrieved again after this response.

Path Parameters
Name Type Required Description
id integer Required The ID of the API key to regenerate.
curl -X POST https://api.proxyhat.com/v1/profile/api-keys/1/regenerate \
  -H "Authorization: Bearer __API_KEY__" \
  -H "Accept: application/json"
import requests

key_id = 1

response = requests.post(
    f"https://api.proxyhat.com/v1/profile/api-keys/{key_id}/regenerate",
    headers={
        "Authorization": "Bearer __API_KEY__",
        "Accept": "application/json",
    },
)

key = response.json()
# Store this new token securely — it will not be shown again
print(f"New token: {key[\"plain_text_token\"]}")
const keyId = 1;

const response = await fetch(`https://api.proxyhat.com/v1/profile/api-keys/${keyId}/regenerate`, {
  method: "POST",
  headers: {
    "Authorization": "Bearer __API_KEY__",
    "Accept": "application/json",
  },
});

const key = await response.json();
// Store this new token securely — it will not be shown again
console.log(`New token: ${key.plain_text_token}`);
keyID := 1
url := fmt.Sprintf("https://api.proxyhat.com/v1/profile/api-keys/%d/regenerate", keyID)

req, _ := http.NewRequest("POST", url, nil)
req.Header.Set("Authorization", "Bearer __API_KEY__")
req.Header.Set("Accept", "application/json")

resp, err := http.DefaultClient.Do(req)
if err != nil {
    log.Fatal(err)
}
defer resp.Body.Close()

var key map[string]interface{}
json.NewDecoder(resp.Body).Decode(&key)
// Store this new token securely — it will not be shown again
fmt.Println("New token:", key["plain_text_token"])
Response 200
{
  "id": 3,
  "name": "My API Key",
  "plain_text_token": "3|newtoken...",
  "created_at": "2026-01-21T12:00:00Z"
}