# API

## Zynapse API Documentation

This documentation provides details on the Zynapse API, designed to interface with a variety of services, including a transformer model for automation tasks, developer support for Leo code, and system administration tasks for nodes using zero-knowledge proof infrastructure.

### Overview

The Zynapse API offers a collection of RESTful endpoints for developers working with Aleo development, node administration, and automated messaging across multiple platforms. It's divided into three key areas:

1. Automation and Chat Interface
2. Developer Tools for Leo Code
3. Zero-Knowledge Proof Infrastructure Management

### Automation and Chat Interface

#### POST `/chat/completions`

**Chat Completions**

This is the primary endpoint used to interact with the Zynapse API's transformer model. It processes commands or natural language input to automate tasks or retrieve information.

**Usage**: Send JSON data with the command or query in the request body. The transformer model processes the input and returns a response facilitating the completion of various automated tasks.

### Developer Tools for Leo Code

#### GET `/query/`

**Query Leo Code Generation**

This endpoint is specifically designed for developers working with Leo code in Aleo projects. It leverages privacy-preserving infrastructure to generate questions or provide assistance related to Leo code.

**Usage**: A GET request to this endpoint will prompt the system to return information or generate queries regarding Leo code. The exact parameters and expected response format should be documented, ensuring developers understand how to structure their requests.

### Zero-Knowledge Proof Infrastructure Management

#### POST `/send_mail`

**Send Email**

Integrates with email systems to send out communications.

#### POST `/send_twitter_dm`

**Send Twitter Direct Messages**

Enables the automated sending of direct messages on Twitter.

#### POST `/send_telegram_dm`

**Send Telegram Direct Messages**

Automates the sending of messages to Telegram users.

#### POST `/request_otp`

**Request OTP**

Generates a one-time password for secure authentication.

#### POST `/authenticate_with_otp`

**Authenticate With OTP**

Provides authentication for users or sessions based on an OTP.

#### POST `/scrape_telegram_member`

**Scrape Telegram Member**

Retrieves member information from a Telegram group for analytics or monitoring.

#### POST `/scrape_whatsapp`

**Scrape WhatsApp**

Extracts data from WhatsApp for various purposes, such as message analysis.

#### POST `/send_whatsapp`

**Send WhatsApp Message**

Allows for the automated sending of WhatsApp messages.

#### POST `/ssh_command`

**SSH Command**

Executes SSH commands for remote management of nodes.

#### POST `/change_password`

**Change Password**

Facilitates the changing of passwords for nodes or services within the infrastructure.

***

## Error Handling and Responses

Endpoints return standard HTTP status codes. A `200 OK` status indicates success. Client-side errors yield a `4xx` status, and server-side issues return a `5xx` status, with accompanying error messages to diagnose issues.

## Security Measures

Communications with sensitive endpoints (`/send_*`, `/authenticate_with_otp`, `/change_password`) should be encrypted, and access should be tightly controlled. Use rate limiting and logging to prevent abuse.

## Rate Limiting

To prevent abuse and ensure fair use, rate limiting is applied to all endpoints. Consult the rate limit policy for details on thresholds and penalties.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zkagi.gitbook.io/introduction/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
