OneAI Market Documentation

Create, customize, and deploy powerful AI agents with no code

No-Code Creation

Build sophisticated AI agents through our intuitive interface

Easy Customization

Tailor agents to your specific needs with simple controls

Instant Deployment

Go from concept to production in minutes

Create

{ "type": "agent" }

Customize

Deploy

API Reference

Integrate OneAI's powerful agents directly into your applications with our comprehensive API:

Vision Agent APIs

Execute Vision Agent

import requests

def execute_vision_agent(api_key, agent_id, image_path):
    url = f"https://oneaimarket.com/api/v1/execute-agent/{agent_id}"
    headers = {"X-Api-Key": api_key}
    
    with open(image_path, 'rb') as image_file:
        files = {'image': ('image.jpg', image_file, 'image/jpeg')}
        response = requests.post(url, headers=headers, files=files)
    
    return response.json()

# Example usage
api_key = "your_api_key"
agent_id = "your_agent_id"
result = execute_vision_agent(
    api_key=api_key,
    agent_id=agent_id,
    image_path="path/to/image.jpg"
)
print(result)
                            
import java.net.URI;
import java.net.http.*;
import java.nio.file.*;

public class VisionAgentExecutor {
    private final String apiKey;
    private final HttpClient client;

    public VisionAgentExecutor(String apiKey) {
        this.apiKey = apiKey;
        this.client = HttpClient.newHttpClient();
    }

    public String executeVisionAgent(String agentId, String imagePath) throws Exception {
        String boundary = "Boundary-" + System.currentTimeMillis();
        String url = "https://oneaimarket.com/api/v1/execute-agent/" + agentId;
        
        byte[] imageBytes = Files.readAllBytes(Path.of(imagePath));
        String CRLF = "\r\n";
        String payload = "--" + boundary + CRLF +
                        "Content-Disposition: form-data; name=\"image\"; filename=\"image.jpg\"" + CRLF +
                        "Content-Type: image/jpeg" + CRLF + CRLF;
        
        byte[] payloadBytes = payload.getBytes();
        byte[] closeBytes = (CRLF + "--" + boundary + "--" + CRLF).getBytes();
        
        byte[] requestBody = new byte[payloadBytes.length + imageBytes.length + closeBytes.length];
        System.arraycopy(payloadBytes, 0, requestBody, 0, payloadBytes.length);
        System.arraycopy(imageBytes, 0, requestBody, payloadBytes.length, imageBytes.length);
        System.arraycopy(closeBytes, 0, requestBody, payloadBytes.length + imageBytes.length, closeBytes.length);

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("X-Api-Key", apiKey)
            .header("Content-Type", "multipart/form-data; boundary=" + boundary)
            .POST(HttpRequest.BodyPublishers.ofByteArray(requestBody))
            .build();

        HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
        return response.body();
    }
}
                            
import Foundation

class VisionAgentExecutor {
    let apiKey: String
    let baseURL = "https://oneaimarket.com/api/v1"
    
    init(apiKey: String) {
        self.apiKey = apiKey
    }
    
    func executeVisionAgent(agentId: String, imageData: Data) async throws -> Data {
        let url = URL(string: "\(baseURL)/execute-agent/\(agentId)")!
        
        var request = URLRequest(url: url)
        request.httpMethod = "POST"
        request.setValue(apiKey, forHTTPHeaderField: "X-Api-Key")
        
        let boundary = "Boundary-\(UUID().uuidString)"
        request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
        
        var body = Data()
        body.append("--\(boundary)\r\n".data(using: .utf8)!)
        body.append("Content-Disposition: form-data; name=\"image\"; filename=\"image.jpg\"\r\n".data(using: .utf8)!)
        body.append("Content-Type: image/jpeg\r\n\r\n".data(using: .utf8)!)
        body.append(imageData)
        body.append("\r\n--\(boundary)--\r\n".data(using: .utf8)!)
        
        request.httpBody = body
        
        let (data, _) = try await URLSession.shared.data(for: request)
        return data
    }
}

// Example usage
Task {
    do {
        let client = VisionAgentExecutor(apiKey: "your_api_key")
        if let imageURL = Bundle.main.url(forResource: "image", withExtension: "jpg"),
           let imageData = try? Data(contentsOf: imageURL) {
            let response = try await client.executeVisionAgent(
                agentId: "your_agent_id",
                imageData: imageData
            )
            if let json = try JSONSerialization.jsonObject(with: response) as? [String: Any] {
                print(json)
            }
        }
    } catch {
        print("Error: \(error)")
    }
}
                            
async function executeVisionAgent(apiKey, agentId, imageFile) {
    const url = `https://oneaimarket.com/api/v1/execute-agent/${agentId}`;
    const formData = new FormData();
    formData.append('image', imageFile);

    try {
        const response = await fetch(url, {
            method: 'POST',
            headers: {
                'X-Api-Key': apiKey
            },
            body: formData
        });

        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }

        const data = await response.json();
        return data;
    } catch (error) {
        console.log('Error:', error);
        throw error;
    }
}

// Example usage
const apiKey = 'your_api_key';
const agentId = 'your_agent_id';

// Using file input
document.querySelector('input[type="file"]').addEventListener('change', async (e) => {
    const imageFile = e.target.files[0];
    try {
        const result = await executeVisionAgent(apiKey, agentId, imageFile);
        console.log(result);
    } catch (error) {
        console.log('Failed to execute vision agent:', error);
    }
});
curl --location 'https://oneaimarket.com/api/v1/execute-agent/your_agent_id' \
--header 'X-Api-Key: your_api_key' \
--form 'image=@"/path/to/image.jpg"'
// Request
POST https://oneaimarket.com/api/v1/execute-agent/{agent_config_id}

Headers:
{
    "X-Api-Key": "string"
}

Form-data:
{
    "image": file    // Image file to analyze
}

// Response
{
    "status": "success",
    "analysis_id": "string",
    "result": {
        // Analysis results
    },
    "credits_used": 2,
    "remaining_balance": int
}

Create Vision Agent

import requests

def create_vision_agent(api_key, image_type, objective):
    url = "https://oneaimarket.com/api/v1/create-agent"
    headers = {
        "X-Api-Key": api_key,
        "Content-Type": "application/json"
    }
    payload = {
        "image_type": image_type,
        "objective": objective
    }
    
    response = requests.post(url, headers=headers, json=payload)
    return response.json()

# Example usage
api_key = "your_api_key"
result = create_vision_agent(
    api_key=api_key,
    image_type="product",
    objective="analyze product features"
)
print(result)
                            
import java.net.URI;
import java.net.http.*;
import java.nio.file.*;

public class VisionAgentClient {
    private final String apiKey;
    private final HttpClient client;

    public VisionAgentClient(String apiKey) {
        this.apiKey = apiKey;
        this.client = HttpClient.newHttpClient();
    }

    public String createVisionAgent(String objective) throws Exception {
        String url = "https://oneaimarket.com/api/v1/create-agent";
        String jsonBody = String.format("""
            {
                "objective": "%s"
            }
            """, objective);

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("X-Api-Key", apiKey)
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonBody))
            .build();

        HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
        return response.body();
    }
}
                            
import Foundation

class VisionAgentClient {
    let apiKey: String
    let baseURL = "https://oneaimarket.com/api/v1"
    
    init(apiKey: String) {
        self.apiKey = apiKey
    }
    
    func createVisionAgent(objective: String) async throws -> Data {
        let url = URL(string: "\(baseURL)/create-agent")!
        var request = URLRequest(url: url)
        request.httpMethod = "POST"
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        request.setValue(apiKey, forHTTPHeaderField: "X-Api-Key")
        
        let payload = [
            "objective": objective
        ]
        request.httpBody = try JSONSerialization.data(withJSONObject: payload)
        
        let (data, _) = try await URLSession.shared.data(for: request)
        return data
    }
}
                            
curl --location 'https://oneaimarket.com/api/v1/create-agent' \
--header 'X-Api-Key: your_api_key' \
--form 'image_type="product"' \
--form 'objective="analyze product features"'
// Request
POST https://oneaimarket.com/api/v1/create-agent

Headers:
{
    "X-Api-Key": "string"    // Your API key
}

Form Data (x-www-form-urlencoded):
image_type=string    // Type of images to analyze
objective=string     // Analysis objective

// Response
{
    "status": "success",
    "agent_config_id": "string",
    "industry": "string",
    "tags": ["string"],
    "configuration": {
        "agent_role": "string",
        "agent_goal": "string",
        "task_description": "string"
    },
    "credits_used": 5,
    "remaining_balance": int
}
async function createVisionAgent(apiKey, imageType, objective) {
    const url = 'https://oneaimarket.com/api/v1/create-agent';
    
    try {
        const response = await fetch(url, {
            method: 'POST',
            headers: {
                'X-Api-Key': apiKey,
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                image_type: imageType,
                objective: objective
            })
        });

        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }

        const data = await response.json();
        return data;
    } catch (error) {
        console.log('Error:', error);
        throw error;
    }
}

// Example usage
const apiKey = 'your_api_key';
try {
    const result = await createVisionAgent(
        apiKey,
        'product',
        'analyze product features'
    );
    console.log(result);
} catch (error) {
    console.log('Failed to create vision agent:', error);
}

Text Agent APIs

Execute Text Agent

import requests

def execute_text_agent(api_key, agent_id, input_text):
    url = f"https://oneaimarket.com/api/v1/execute-text-agent/{agent_id}"
    headers = {
        "X-Api-Key": api_key,
        "Content-Type": "application/json"
    }
    payload = {
        "input_text": input_text
    }
    
    response = requests.post(url, headers=headers, json=payload)
    return response.json()

# Example usage
api_key = "your_api_key"
agent_id = "your_agent_id"
result = execute_text_agent(
    api_key=api_key,
    agent_id=agent_id,
    input_text="Sample text for analysis"
)
print(result)
import java.net.URI;
import java.net.http.*;

public class TextAgentExecutor {
    private final String apiKey;
    private final HttpClient client;

    public TextAgentExecutor(String apiKey) {
        this.apiKey = apiKey;
        this.client = HttpClient.newHttpClient();
    }

    public String executeTextAgent(String agentId, String inputText) throws Exception {
        String url = "https://oneaimarket.com/api/v1/execute-text-agent/" + agentId;
        String jsonBody = String.format("""
            {
                "input_text": "%s"
            }
            """, inputText);

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("X-Api-Key", apiKey)
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonBody))
            .build();

        HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
        return response.body();
    }
}
import Foundation

class TextAgentExecutor {
    let apiKey: String
    let baseURL = "https://oneaimarket.com/api/v1"
    
    init(apiKey: String) {
        self.apiKey = apiKey
    }
    
    func executeTextAgent(agentId: String, inputText: String) async throws -> Data {
        let url = URL(string: "\(baseURL)/execute-text-agent/\(agentId)")!
        var request = URLRequest(url: url)
        request.httpMethod = "POST"
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        request.setValue(apiKey, forHTTPHeaderField: "X-Api-Key")
        
        let payload = [
            "input_text": inputText
        ]
        request.httpBody = try JSONSerialization.data(withJSONObject: payload)
        
        let (data, _) = try await URLSession.shared.data(for: request)
        return data
    }
}
                            
async function executeTextAgent(apiKey, agentId, inputText) {
    const url = `https://oneaimarket.com/api/v1/execute-text-agent/${agentId}`;
    
    try {
        const response = await fetch(url, {
            method: 'POST',
            headers: {
                'X-Api-Key': apiKey,
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                input_text: inputText
            })
        });

        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }

        const data = await response.json();
        return data;
    } catch (error) {
        console.log('Error:', error);
        throw error;
    }
}

// Example usage
const apiKey = 'your_api_key';
const agentId = 'your_agent_id';
try {
    const result = await executeTextAgent(
        apiKey,
        agentId,
        'Sample text for analysis'
    );
    console.log(result);
} catch (error) {
    console.log('Failed to execute text agent:', error);
}
curl --location 'https://oneaimarket.com/api/v1/execute-text-agent/your_agent_id' \
--header 'X-Api-Key: your_api_key' \
--header 'Content-Type: application/json' \
--data '{
    "input_text": "Sample text for analysis"
}'
// Request
POST https://oneaimarket.com/api/v1/execute-text-agent/{agent_config_id}

Headers:
{
    "X-Api-Key": "string"
}

Body:
{
    "input_text": "string"    // Text to analyze
}

// Response
{
    "status": "success",
    "analysis_id": "string",
    "result": {
        // Analysis results
    },
    "credits_used": 2,
    "remaining_balance": int
}

Create Text Agent

import requests

def create_text_agent(api_key, objective):
    url = "https://oneaimarket.com/api/v1/create-text-agent"
    headers = {
        "X-Api-Key": api_key,
        "Content-Type": "application/json"
    }
    payload = {
        "objective": objective
    }
    
    response = requests.post(url, headers=headers, json=payload)
    return response.json()

# Example usage
api_key = "your_api_key"
result = create_text_agent(
    api_key=api_key,
    objective="analyze text content"
)
print(result)
import java.net.URI;
import java.net.http.*;

public class TextAgentClient {
    private final String apiKey;
    private final HttpClient client;

    public TextAgentClient(String apiKey) {
        this.apiKey = apiKey;
        this.client = HttpClient.newHttpClient();
    }

    public String createTextAgent(String objective) throws Exception {
        String url = "https://oneaimarket.com/api/v1/create-text-agent";
        String jsonBody = String.format("""
            {
                "objective": "%s"
            }
            """, objective);

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("X-Api-Key", apiKey)
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonBody))
            .build();

        HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
        return response.body();
    }
}
                            
import Foundation

class TextAgentClient {
    let apiKey: String
    let baseURL = "https://oneaimarket.com/api/v1"
    
    init(apiKey: String) {
        self.apiKey = apiKey
    }
    
    func createTextAgent(objective: String) async throws -> Data {
        let url = URL(string: "\(baseURL)/create-text-agent")!
        var request = URLRequest(url: url)
        request.httpMethod = "POST"
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        request.setValue(apiKey, forHTTPHeaderField: "X-Api-Key")
        
        let payload = [
            "objective": objective
        ]
        request.httpBody = try JSONSerialization.data(withJSONObject: payload)
        
        let (data, _) = try await URLSession.shared.data(for: request)
        return data
    }
}
                            
curl --location 'https://oneaimarket.com/api/v1/create-text-agent' \
--header 'X-Api-Key: your_api_key' \
--header 'Content-Type: application/json' \
--data '{
    "objective": "analyze text"
}'
// Request
POST https://oneaimarket.com/api/v1/create-text-agent

Headers:
{
    "X-Api-Key": "string"
}

Body:
{
    "objective": "string"    // Analysis objective
}

// Response
{
    "status": "success",
    "agent_config_id": "string",
    "industry": "string",
    "tags": ["string"],
    "configuration": {
        "agent_role": "string",
        "agent_goal": "string",
        "task_description": "string"
    },
    "credits_used": 5,
    "remaining_balance": int
}
async function createTextAgent(apiKey, objective) {
    const url = 'https://oneaimarket.com/api/v1/create-text-agent';
    
    try {
        const response = await fetch(url, {
            method: 'POST',
            headers: {
                'X-Api-Key': apiKey,
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                objective: objective
            })
        });

        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }

        const data = await response.json();
        return data;
    } catch (error) {
        console.log('Error:', error);
        throw error;
    }
}

// Example usage
const apiKey = 'your_api_key';
try {
    const result = await createTextAgent(
        apiKey,
        'analyze text content'
    );
    console.log(result);
} catch (error) {
    console.log('Failed to create text agent:', error);
}

Error Handling

Common API response codes and troubleshooting:

200: Successful request
400: Bad request - Check input parameters
401: Unauthorized - Invalid API key
403: Forbidden - Insufficient credits or permissions
429: Too Many Requests - Rate limit exceeded
500: Internal Server Error - Contact support
                

Error responses include:

  • Detailed error message
  • Error code
  • Request ID for support
  • Suggested resolution steps

Best Practices

  • Implementation recommendations:
    • Implement retry logic with exponential backoff
    • Cache results when possible
    • Use batch processing for multiple items
    • Monitor credit usage and set alerts
  • Performance optimization:
    • Compress large payloads
    • Use appropriate timeout values
    • Implement request queuing
    • Monitor response times