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://zkp-engine-main-1.vercel.appAll API endpoints are relative to this base URL
Choose the authentication method that works best for your use case
Include your project key in the x-api-key header
x-api-key: zka_live_your_api_keyUse zka_test keys for sandbox requests
x-api-key: zka_test_your_api_keyUser routes also require the login session token
Authorization: Bearer eyJ...Complete list of available API endpoints
/api/v1/auth/registerRegister a new user with ZK commitment
{
"email": "string",
"password": "string",
"deviceInfo": "object"
}{
"success": "boolean",
"data": "{ userId, deviceId, emailVerified }"
}/api/v1/auth/loginAuthenticate user with ZK proof
{
"email": "string",
"password": "string",
"deviceInfo": "object"
}{
"success": "boolean",
"data": "{ user, session }"
}/api/v1/auth/meVerify session token
{
"token": "string"
}{
"valid": "boolean",
"user": "User object"
}/api/v1/auth/logoutInvalidate session
{
"token": "string"
}{
"success": "boolean"
}/api/v1/auth/meGet user profile
"None"{
"user": "User object"
}/api/v1/auth/meUpdate user profile
{
"name": "string",
"avatar": "string"
}{
"success": "boolean",
"user": "User object"
}See how to use the API in different languages
curl -X POST https://zkp-engine-main-1.vercel.app/api/v1/auth/register \
-H "Content-Type: application/json" \
-H "x-api-key: zka_live_your_api_key" \
-d '{
"email": "user@example.com",
"password": "secure_password",
"deviceInfo": {
"deviceName": "Chrome on MacBook",
"deviceType": "desktop"
}
}'const response = await fetch('https://zkp-engine-main-1.vercel.app/api/v1/auth/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'zka_live_your_api_key'
},
body: JSON.stringify({
email: 'user@example.com',
password: 'secure_password',
deviceInfo: {
deviceName: 'Chrome on MacBook',
deviceType: 'desktop'
}
})
});
const data = await response.json();
console.log(data);import requests
response = requests.post(
'https://zkp-engine-main-1.vercel.app/api/v1/auth/register',
headers={
'Content-Type': 'application/json',
'x-api-key': 'zka_live_your_api_key'
},
json={
'email': 'user@example.com',
'password': 'secure_password',
'deviceInfo': {
'deviceName': 'Chrome on MacBook',
'deviceType': 'desktop'
}
}
)
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://zkp-engine-main-1.vercel.app/api/v1/auth/register",
bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-api-key", "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://zkp-engine-main-1.vercel.app/api/v1/auth/register")
.header("Content-Type", "application/json")
.header("x-api-key", "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://zkp-engine-main-1.vercel.app/api/v1/auth/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': '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>