API Reference

Complete API documentation for integrating a9x11 ai into your applications. RESTful endpoints, SDKs, and code examples.

API Endpoints

POST
Core

/api/v1/save

Save code changes with AI analysis

GET
Core

/api/v1/preview/{id}

Get code preview with syntax highlighting

POST
Core

/api/v1/restore

Restore code to previous version

GET
AI

/api/v1/ai/suggestions

Get AI-powered code suggestions

POST
AI

/api/v1/ai/refactor

Refactor code using AI

GET
Git

/api/v1/git/status

Get Git repository status

POST
Git

/api/v1/git/commit

Create automated Git commit

GET
Projects

/api/v1/projects

List all projects

Code Examples

Save Code Changes

Save your code with AI analysis and automatic optimization suggestions.

Request

curl -X POST https://api.a9x11 ai/v1/save \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "proj_123",
    "file_path": "src/components/Button.tsx",
    "content": "export const Button = ({ children, onClick }) => {\n  return (\n    <button onClick={onClick} className=\"btn\">\n      {children}\n    </button>\n  );\n};",
    "language": "typescript",
    "ai_analysis": true
  }'

Response

{
  "success": true,
  "data": {
    "save_id": "save_456",
    "ai_suggestions": [
      {
        "type": "optimization",
        "message": "Consider adding PropTypes or TypeScript interfaces for better type safety",
        "line": 1,
        "severity": "info"
      }
    ],
    "optimized_content": "export interface ButtonProps {\n  children: React.ReactNode;\n  onClick: () => void;\n}\n\nexport const Button: React.FC<ButtonProps> = ({ children, onClick }) => {\n  return (\n    <button onClick={onClick} className=\"btn\">\n      {children}\n    </button>\n  );\n};"
  }
}

Official SDKs

JavaScript/Node.js

javascript

Install: npm install @a9x11/sdk

import { A9X11Client } from '@a9x11/sdk';

const client = new A9X11Client({
  apiKey: process.env.A9X11_API_KEY
});

// Save code
const result = await client.save({
  projectId: 'proj_123',
  filePath: 'src/App.js',
  content: codeContent,
  language: 'javascript'
});

Python

python

Install: pip install a9x11-sdk

from a9x11 import A9X11Client

client = A9X11Client(api_key="your_api_key")

# Save code
result = client.save(
    project_id="proj_123",
    file_path="src/app.py",
    content=code_content,
    language="python"
)

Go

go

Install: go get github.com/a9x11/go-sdk

package main

import "github.com/a9x11/go-sdk"

func main() {
    client := a9x11.NewClient("your_api_key")
    
    result, err := client.Save(a9x11.SaveRequest{
        ProjectID: "proj_123",
        FilePath:  "src/main.go",
        Content:   codeContent,
        Language:  "go",
    })
}

Ready to Start Building?

Get your API key and start integrating a9x11 ai into your applications today.