API key
Your API key authenticates requests to the Uthana API. Keep it private and rotate it if you suspect it has been compromised.
Get your API key
- Create an account at uthana.com.
- Choose an API-enabled plan on the pricing page.
- Open your account settings at uthana.com/app/account.
- Generate a new API key.
- (Optional) paste it into the
API keyfield (in the top-right corner of the page) to use it with the Uthana API docs (desktop version only).
Use your API key
The official Python and JavaScript/TypeScript clients handle authentication for you. Pass your key when constructing the client. For other languages, use HTTP Basic auth with your API key as the username and an empty password.
- Shell
- Python
- TypeScript
- React
- C#
API_KEY="{{apiKey}}"
curl "https://uthana.com/graphql" \
-u $API_KEY: \
-H "Content-Type: application/json" \
-d '{"query": "{ __typename }"}'
import asyncio
from uthana import Uthana
client = Uthana("{{apiKey}}")
async def main():
user = await client.org.get_user()
print(user.get("name"), user.get("email"))
asyncio.run(main())
Install: pip install uthana · Python client docs
import { UthanaClient } from "@uthana/client";
const client = new UthanaClient("{{apiKey}}");
// Confirm the key is valid
const user = await client.org.getUser();
console.log(user.name, user.email);
Install: npm install @uthana/client · JS/TS client docs
import { UthanaProvider, useUthanaUser } from "@uthana/react";
// Wrap your app once — all hooks work inside the provider
function App() {
return (
<UthanaProvider apiKey="{{apiKey}}">
<UserInfo />
</UthanaProvider>
);
}
function UserInfo() {
const { user } = useUthanaUser();
return <p>{user ? `Authenticated as ${user.name}` : "Loading..."}</p>;
}
Install: npm install @uthana/react @uthana/client @tanstack/react-query · JS/TS client docs
var request = new
{
query = "{ __typename }"
};
var json = JsonSerializer.Serialize(request);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var authValue = Convert.ToBase64String(Encoding.UTF8.GetBytes("{{apiKey}}:"));
_httpClient.DefaultRequestHeaders.Authorization =
new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", authValue);
var response = await _httpClient.PostAsync("https://uthana.com/graphql", content);
response.EnsureSuccessStatusCode();
Custom domain
If you use a non-default API host, pass the domain option:
- Shell
- Python
- TypeScript
- React
- C#
# Replace uthana.com with your custom domain in all request URLs
curl "https://custom.uthana.example/graphql" \
-u $API_KEY: \
-H "Content-Type: application/json" \
-d '{"query": "{ __typename }"}'
client = Uthana("{{apiKey}}", domain="custom.uthana.example")
const client = new UthanaClient("{{apiKey}}", { domain: "custom.uthana.example" });
<UthanaProvider apiKey="{{apiKey}}" domain="custom.uthana.example">
<App />
</UthanaProvider>
Replace uthana.com with your custom domain in all request URLs.
Security tips
- Treat your API key like a password.
- Store it in a secret manager or environment variable, not in source code.
- Rotate the key if it appears in logs or shared code.