Skip to main content

API Introduction

The Zygotrix API provides programmatic access to all genetics tools and features.

Base URL

Development: http://localhost:8000/api
Production: https://api.zygotrix.com/api

Authentication

Most endpoints require authentication via JWT tokens.

Getting a Token

curl -X POST http://localhost:8000/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "your-password"
}'

Response:

{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "bearer",
"user": {
"id": "...",
"email": "user@example.com",
"full_name": "John Doe"
}
}

Using the Token

Include the token in the Authorization header:

curl http://localhost:8000/api/protected-endpoint \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response Format

All responses are JSON with consistent structure:

Success Response

{
"data": { ... },
"message": "Success"
}

Error Response

{
"detail": "Error message here"
}

HTTP Status Codes

CodeDescription
200Success
201Created
400Bad Request (invalid input)
401Unauthorized (missing/invalid token)
403Forbidden (insufficient permissions)
404Not Found
422Validation Error
500Server Error

Rate Limiting

Endpoint TypeLimit
Authentication10/minute
General API100/minute
GWAS Upload5/hour

API Categories

Authentication

Traits

DNA Tools

GWAS

AI Chatbot

Interactive Documentation

Visit /docs for Swagger UI:

http://localhost:8000/docs

Or ReDoc:

http://localhost:8000/redoc

SDKs & Libraries

Coming soon:

  • Python SDK
  • JavaScript/TypeScript SDK
  • R package for GWAS