Complete REST API documentation for ZKAuth. All endpoints, authentication methods, and response formats.
All API requests should be made to the following base URL
https://api.zkauth.comAll API endpoints are relative to this base URL
Choose the authentication method that works best for your use case
Include your API key in the Authorization header
Authorization: Bearer zka_live_your_api_keyInclude your API key in the x-api-key header
x-api-key: zka_live_your_api_keyInclude your API key as a query parameter
?api_key=zka_live_your_api_keyComplete list of available API endpoints
/api/v1/auth/signupRegister a new user
{
"email": "string",
"password": "string"
}{
"success": "boolean",
"user": "User object"
}/api/v1/auth/signinAuthenticate user with ZK proof
{
"email": "string",
"password": "string"
}{
"success": "boolean",
"session": "Session object"
}/api/v1/auth/verifyVerify session token
{
"token": "string"
}{
"valid": "boolean",
"user": "User object"
}/api/v1/auth/signoutInvalidate session
{
"token": "string"
}{
"success": "boolean"
}/api/v1/user/profileGet user profile
"None"{
"user": "User object"
}/api/v1/user/profileUpdate user profile
{
"name": "string",
"avatar": "string"
}{
"success": "boolean",
"user": "User object"
}See how to use the API in different languages
curl -X POST https://api.zkauth.com/api/v1/auth/signup \
-H "Content-Type: application/json" \
-H "Authorization: Bearer zka_live_your_api_key" \
-d '{
"email": "user@example.com",
"password": "secure_password"
}'const response = await fetch('https://api.zkauth.com/api/v1/auth/signup', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer zka_live_your_api_key'
},
body: JSON.stringify({
email: 'user@example.com',
password: 'secure_password'
})
});
const data = await response.json();
console.log(data);import requests
response = requests.post(
'https://api.zkauth.com/api/v1/auth/signup',
headers={
'Content-Type': 'application/json',
'Authorization': 'Bearer zka_live_your_api_key'
},
json={
'email': 'user@example.com',
'password': 'secure_password'
}
)
data = response.json()
print(data)package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
payload := map[string]string{
"email": "user@example.com",
"password": "secure_password",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST",
"https://api.zkauth.com/api/v1/auth/signup",
bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer zka_live_your_api_key")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result)
}use reqwest;
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.post("https://api.zkauth.com/api/v1/auth/signup")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer zka_live_your_api_key")
.json(&json!({
"email": "user@example.com",
"password": "secure_password"
}))
.send()
.await?;
let data: Value = response.json().await?;
println!("{:?}", data);
Ok(())
}<template>
<div>
<button @click="signUp" :disabled="loading">
{{ loading ? 'Signing up...' : 'Sign Up' }}
</button>
</div>
</template>
<script>
export default {
data() {
return {
loading: false
}
},
methods: {
async signUp() {
this.loading = true;
try {
const response = await fetch('https://api.zkauth.com/api/v1/auth/signup', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer zka_live_your_api_key'
},
body: JSON.stringify({
email: 'user@example.com',
password: 'secure_password'
})
});
const data = await response.json();
console.log('User created:', data);
} catch (error) {
console.error('Sign up failed:', error);
} finally {
this.loading = false;
}
}
}
}
</script>