### Send Email API Source: https://docs.aiinbx.com/quickstart This endpoint allows you to send an email through your AI Inbx organization. It requires authentication and a JSON payload specifying the recipient, sender, subject, and content. ```APIDOC ## POST /api/v1/emails/send ### Description Sends an email using the AI Inbx API. This is a core function for transactional or marketing emails. ### Method POST ### Endpoint /api/v1/emails/send ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **to** (string) - Required - The email address of the recipient. - **from** (string) - Required - The email address of the sender. Should be a verified sender within your AI Inbx organization (e.g., `hello@your-org-slug.aiinbx.app`). - **subject** (string) - Required - The subject line of the email. - **html** (string) - Optional - The HTML content of the email body. - **text** (string) - Optional - The plain text content of the email body. If both `html` and `text` are provided, `html` will be used by default. ### Request Example ```json { "to": "recipient@example.com", "from": "hello@your-org-slug.aiinbx.app", "subject": "Hello from AI Inbx!", "html": "

This is my first email sent through AI Inbx.

" } ``` ### Response #### Success Response (200) - **emailId** (string) - The unique identifier for the sent email. - **threadId** (string) - The identifier for the conversation thread this email belongs to. - **messageId** (string) - The unique identifier for the email message, often in RFC2822 format. #### Response Example ```json { "emailId": "email_abc123", "threadId": "thread_xyz789", "messageId": "" } ``` ``` -------------------------------- ### Send First Email using cURL Source: https://docs.aiinbx.com/quickstart This snippet demonstrates how to send your first email using AI Inbx via a cURL request. It requires an API key for authentication and specifies recipient, sender, subject, and HTML content. The output includes email, thread, and message IDs. ```bash curl -X POST "https://aiinbx.com/api/v1/emails/send" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "recipient@example.com", "from": "hello@your-org-slug.aiinbx.app", "subject": "Hello from AI Inbx!", "html": "

This is my first email sent through AI Inbx.

" }' ``` ```json { "emailId": "email_abc123", "threadId": "thread_xyz789", "messageId": "" } ``` -------------------------------- ### Retrieve Domain - Python Client Source: https://docs.aiinbx.com/api-reference/domains/get-domain-by-id Example demonstrating how to fetch domain details using the AIINbx Python client. It sets up the client with an API key and uses the `domains.retrieve` method to get domain data, printing the domain's ID. Ensure the `aiinbx` library is installed. ```python from aiinbx import AIInbx client = AIInbx( api_key="My API Key", ) domain = client.domains.retrieve( "domainId", ) print(domain.id) ``` -------------------------------- ### Install AI Inbx Python SDK Source: https://docs.aiinbx.com/sdks/python Installs the AI Inbx Python SDK using various package managers. Ensure you have the chosen package manager installed. ```bash pip install aiinbx ``` ```bash pipenv install aiinbx ``` ```bash poetry add aiinbx ``` ```bash uv add aiinbx ``` -------------------------------- ### Install AI Inbx SDK with Package Managers Source: https://docs.aiinbx.com/sdks/typescript Install the AI Inbx TypeScript SDK using npm, yarn, pnpm, or bun. These commands add the SDK as a dependency to your project. ```bash npm install aiinbx ``` ```bash yarn add aiinbx ``` ```bash pnpm add aiinbx ``` ```bash bun add aiinbx ``` -------------------------------- ### Retrieve Domain - JavaScript Client Source: https://docs.aiinbx.com/api-reference/domains/get-domain-by-id Example of how to retrieve domain information using the AIINbx JavaScript client. It initializes the client with an API key and calls the `retrieve` method on the `domains` service, logging the domain ID upon success. This requires the `aiinbx` package to be installed. ```javascript import AIInbx from 'aiinbx'; const client = new AIInbx({ apiKey: 'My API Key', }); const domain = await client.domains.retrieve('domainId'); console.log(domain.id); ``` -------------------------------- ### Full Example: AI-Powered Support Bot with Next.js and LLM Source: https://docs.aiinbx.com/sdks/typescript An end-to-end example demonstrating a serverless AI-powered support bot using Next.js, AI Inbx SDK, and OpenAI's GPT-4.1-mini. It handles inbound emails, formats the conversation for an LLM, generates a reply, and sends it back via AI Inbx. ```typescript import { openai } from '@ai-sdk/openai'; import { generateObject } from 'ai'; import { z } from 'zod'; import AIInbx from 'aiinbx'; import { createNextRouteHandler, emailToLLMString, threadToLLMString, } from 'aiinbx/helpers'; const aiInbx = new AIInbx(); export const POST = createNextRouteHandler({ onInboundEmail: async ({ payload }) => { const { email } = payload.data; const thread = await aiInbx.threads.retrieve(email.threadId); const { object } = await generateObject({ model: openai('gpt-4.1-mini'), schema: z.object({ responseHtml: z.string(), }), system: `You are a helpful assistant that can gets incoming emails and should answer them as a human would.`, prompt: `Here are the emails so far: ${threadToLLMString(thread)} Here is the new email: ${emailToLLMString(email)} Please answer the email as a human would.`, }); await aiInbx.emails.reply(email.id, { from: 'support@your-domain.com', html: object.responseHtml, }); return Response.json({ sent: true }); }, }); ``` -------------------------------- ### Quick Start: Initialize AI Inbx Client and Basic Operations Source: https://docs.aiinbx.com/sdks/typescript Demonstrates how to initialize the AI Inbx client with an API key (either from environment variables or explicitly passed) and perform basic operations like searching threads and replying to an email. ```typescript import AIInbx from 'aiinbx'; // If using the default environment variable AI_INBX_API_KEY const aiInbx = new AIInbx(); // Or explicitly pass your API key // const aiInbx = new AIInbx({ // apiKey: 'your-api-key-here', // }); // Search threads const response = await aiInbx.threads.search({}); console.log(response.threads); const newestThread = response.threads[0]; const newestEmail = newestThread.emails[0]; // Reply to an email await aiInbx.emails.reply(newestEmail.id, { from: "your-domain@example.com", html: "

This is a test reply email

" }); ``` -------------------------------- ### GET /websites/aiinbx Source: https://docs.aiinbx.com/api-reference/domains/verify-domain-dns-%26-ses-status Retrieves the verification status and DNS details for a given domain. ```APIDOC ## GET /websites/aiinbx ### Description Retrieves the verification status and DNS details for a given domain. This includes information about SPF, DKIM, DMARC, MX records, and potential conflicts. ### Method GET ### Endpoint /websites/aiinbx ### Parameters #### Query Parameters - **domain** (string) - Required - The domain name to check verification status for. ### Request Example ``` GET /websites/aiinbx?domain=example.com ``` ### Response #### Success Response (200) - **domain** (object) - Contains details about the domain, including its ID, creation dates, verification status, and DNS records. - **id** (string) - Unique identifier for the domain. - **createdAt** (string) - Timestamp when the domain was created. - **updatedAt** (string) - Timestamp when the domain was last updated. - **domain** (string) - The domain name. - **verifiedAt** (string) - Timestamp when the domain was verified. - **status** (string) - The verification status of the domain (e.g., VERIFIED). - **dnsRecords** (array) - List of DNS records associated with the domain. - **type** (string) - The type of DNS record (e.g., TXT). - **name** (string) - The name of the DNS record. - **value** (string) - The value of the DNS record. - **priority** (number) - The priority of the DNS record (if applicable). - **isVerified** (boolean) - Indicates if the DNS record is verified. - **verificationStatus** (string) - The verification status of the individual DNS record. - **lastCheckedAt** (string) - Timestamp when the DNS record was last checked. - **verification** (object) - Contains overall verification statuses. - **verification** (string) - General verification status. - **dkimStatus** (string) - DKIM verification status. - **dns** (object) - DNS specific verification details. - **domainVerification** (boolean) - Indicates if domain verification is complete. - **spf** (boolean) - Indicates if SPF record is correctly configured. - **mx** (object) - Details about MX record configuration. - **found** (boolean) - Indicates if an MX record was found. - **expectedPriority** (number) - The expected priority for the MX record. - **records** (array) - List of found MX records. - **exchange** (string) - The mail server exchange. - **priority** (number) - The priority of the MX record. - **dkim** (object) - Details about DKIM record configuration. - **dmarc** (object) - Details about DMARC record configuration. - **present** (boolean) - Indicates if a DMARC record is present. - **source** (string) - The source of the DMARC record configuration. - **dkim** (object) - Detailed DKIM status. - **dmarc** (object) - Detailed DMARC status. - **mxConflict** (object) - Information about MX record conflicts. - **hasConflict** (boolean) - True if there are MX record conflicts. - **conflictingRecords** (array) - A list of conflicting MX records. - **exchange** (string) - The exchange server of the conflicting record. - **priority** (number) - The priority of the conflicting record. - **message** (string) - A message describing the MX conflict. - **ready** (boolean) - Indicates if the domain is ready for use. - **debug** (object) - Debugging information for verification. - **expectedVerificationToken** (string) - The expected verification token. - **actualVerificationTokens** (array) - An array of actual verification tokens found. - **domain** (string) - The domain name used for debugging. - **verificationTokenMatch** (boolean) - Indicates if the verification tokens match. #### Response Example ```json { "domain": { "id": "", "createdAt": "", "updatedAt": "", "domain": "example.com", "verifiedAt": "", "status": "VERIFIED", "dnsRecords": [ { "type": "TXT", "name": "", "value": "", "priority": 123, "isVerified": true, "verificationStatus": "verified", "lastCheckedAt": "" } ] }, "verification": { "verification": "Pending", "dkimStatus": "Pending", "dns": { "domainVerification": true, "spf": true, "mx": { "found": true, "expectedPriority": 123, "records": [ { "exchange": "", "priority": 123 } ] }, "dkim": {}, "dmarc": { "present": true, "source": "parent" } }, "dkim": {}, "dmarc": {} }, "mxConflict": { "hasConflict": false, "conflictingRecords": [], "message": "" }, "ready": true, "debug": { "expectedVerificationToken": "", "actualVerificationTokens": [ "" ], "domain": "example.com", "verificationTokenMatch": true } } ``` #### Error Response (400) - **message** (string) - Error message if the domain is not found or an invalid parameter is provided. ``` -------------------------------- ### Async Usage: High-Concurrency AI Inbx Python SDK Source: https://docs.aiinbx.com/sdks/python Demonstrates asynchronous usage of the AI Inbx client for high-concurrency workloads. It performs the same actions as the synchronous example but uses async/await syntax. Requires an 'AI_INBX_API_KEY' environment variable. ```python import os import asyncio from aiinbx import AsyncAIInbx client = AsyncAIInbx( api_key=os.environ.get("AI_INBX_API_KEY"), ) async def main() -> None: search = await client.threads.search() newest_thread = search.threads[0] thread = await client.threads.retrieve(newest_thread.id) newest_email = thread.emails[-1] await client.emails.reply(newest_email.id, { "from": "support@your-domain.com", "html": "

This is a test reply email

", }) asyncio.run(main()) ``` -------------------------------- ### Create Domain Endpoint Documentation and Examples Source: https://docs.aiinbx.com/api-reference/domains/create-domain This section details the POST /domains endpoint for creating a new domain within the AIinbx service. It specifies the request body schema, including the 'domain' property with its pattern and length constraints, and outlines the successful response structure containing 'domainId' and 'records'. Error responses for 400 and 401 status codes are also described. Dependencies include the AIinbx client library for the respective languages. The input is a JSON object with a 'domain' string, and the output is a JSON object with domain details or an error object. ```yaml paths: path: /domains method: post servers: - url: https://api.aiinbx.com/api/v1 request: security: - title: BearerAuth parameters: query: {} header: Authorization: type: http scheme: bearer description: API Key authentication using Bearer token cookie: {} parameters: path: {} query: {} header: {} cookie: {} body: application/json: schemaArray: - type: object properties: domain: allOf: - type: string pattern: >- ^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[A-Za-z]{2,}$ minLength: 1 required: true requiredProperties: - domain examples: example: value: domain: response: '200': application/json: schemaArray: - type: object properties: domainId: allOf: - type: string records: allOf: - type: array items: type: object properties: type: type: string enum: - TXT - CNAME - MX name: type: string value: type: string priority: type: number required: - type - name - value requiredProperties: - domainId - records examples: example: value: domainId: records: - type: TXT name: value: priority: 123 description: Successful response '400': application/json: schemaArray: - type: object properties: message: allOf: - type: string description: The error message example: Invalid input data code: allOf: - type: string description: The error code example: BAD_REQUEST issues: allOf: - type: array items: type: object properties: message: type: string required: - message description: An array of issues that were responsible for the error example: [] title: Invalid input data error (400) description: The error information refIdentifier: '#/components/schemas/error.BAD_REQUEST' requiredProperties: - message - code example: code: BAD_REQUEST message: Invalid input data issues: [] examples: example: value: code: BAD_REQUEST message: Invalid input data issues: [] description: Invalid input data '401': application/json: schemaArray: - type: object properties: message: allOf: - type: string description: The error message example: Authorization not provided code: allOf: - type: string description: The error code example: UNAUTHORIZED issues: allOf: ``` ```JavaScript import AIInbx from 'aiinbx'; const client = new AIInbx({ apiKey: 'My API Key', }); const domain = await client.domains.create({ domain: 'sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.ukBXb', }); console.log(domain.domainId); ``` ```Python from aiinbx import AIInbx client = AIInbx( api_key="My API Key", ) domain = client.domains.create( domain="sfN2.l.iJR-BU.u9JV9.a.m.o2D-4b-Jd.0Z-kX.L.n.S.f.ukBXb", ) print(domain.domain_id) ``` -------------------------------- ### Quick Start: Synchronous AI Inbx Python SDK Usage Source: https://docs.aiinbx.com/sdks/python Initializes the AI Inbx client, searches for threads, retrieves the newest thread with its emails, and replies to the last email. Requires an 'AI_INBX_API_KEY' environment variable. It's recommended to use environment variables for API keys. ```python import os from aiinbx import AIInbx client = AIInbx( api_key=os.environ.get("AI_INBX_API_KEY"), # default when unset too ) # Search threads (newest first by default) search = client.threads.search() newest_thread = search.threads[0] # Retrieve full thread with emails thread = client.threads.retrieve(newest_thread.id) newest_email = thread.emails[-1] # Reply to the email client.emails.reply(newest_email.id, { "from": "support@your-domain.com", "html": "

This is a test reply email

", }) ``` -------------------------------- ### GET /domains Source: https://docs.aiinbx.com/api-reference/domains/list-domains Retrieves a list of domains associated with your account. This endpoint allows you to fetch domain details, their verification status, and associated DNS records. ```APIDOC ## GET /domains ### Description Retrieves a list of domains. This endpoint allows you to fetch domain details, their verification status, and associated DNS records. ### Method GET ### Endpoint /domains ### Parameters #### Query Parameters *None* #### Header Parameters * **Authorization** (string) - Required - API Key authentication using Bearer token ### Request Example ``` // No request body for this endpoint ``` ### Response #### Success Response (200) - **domains** (array) - An array of domain objects. - **id** (string) - Unique identifier for the domain. - **createdAt** (string) - Timestamp when the domain was created. - **updatedAt** (string) - Timestamp when the domain was last updated. - **domain** (string) - The domain name. - **verifiedAt** (string) - Timestamp when the domain was verified. Can be null. - **status** (string) - The verification status of the domain (e.g., VERIFIED, PENDING_VERIFICATION, NOT_REGISTERED). - **dnsRecords** (array, nullable) - An array of DNS records associated with the domain. Can be null. - **type** (string) - The type of DNS record (e.g., TXT, CNAME, MX). - **name** (string) - The name of the DNS record. - **value** (string) - The value of the DNS record. - **priority** (number) - The priority of the DNS record (if applicable). - **isVerified** (boolean) - Indicates if the DNS record is verified. - **verificationStatus** (string) - The verification status of the DNS record (e.g., verified, missing, pending). - **lastCheckedAt** (string) - Timestamp when the DNS record was last checked. #### Error Response (401) - **message** (string) - The error message (e.g., "Authorization not provided"). - **code** (string) - The error code (e.g., "UNAUTHORIZED"). - **issues** (array) - An array of issue objects, each with a message. #### Response Example (200) ```json { "domains": [ { "id": "", "createdAt": "", "updatedAt": "", "domain": "example.com", "verifiedAt": "2023-10-27T10:00:00Z", "status": "VERIFIED", "dnsRecords": [ { "type": "TXT", "name": "_dmarc", "value": "v=DMARC1; p=none", "priority": null, "isVerified": true, "verificationStatus": "verified", "lastCheckedAt": "2023-10-27T09:55:00Z" } ] } ] } ``` #### Response Example (401) ```json { "message": "Authorization not provided", "code": "UNAUTHORIZED", "issues": [ { "message": "Missing or invalid API key" } ] } ``` ``` -------------------------------- ### Internal Server Error (500) Source: https://docs.aiinbx.com/api-reference/domains/verify-domain-dns-%26-ses-status This endpoint details the structure and examples of a 500 Internal Server Error response, including error messages, codes, and specific issues. ```APIDOC ## Error Response: Internal Server Error (500) ### Description This structure represents a standard internal server error response. It provides details about the error, including a general message, a specific error code, and an optional array of more granular issues. ### Method N/A (This describes an error response, not a specific request method) ### Endpoint N/A (This describes an error response, not a specific endpoint) ### Parameters N/A ### Request Example N/A ### Response #### Success Response (500) - **message** (string) - The general error message indicating an internal server error. - **code** (string) - A specific error code identifying the type of internal server error (e.g., INTERNAL_SERVER_ERROR). - **issues** (array) - An optional array of objects, where each object contains a 'message' detailing specific problems that contributed to the error. Defaults to an empty array if no specific issues are found. #### Response Example ```json { "code": "INTERNAL_SERVER_ERROR", "message": "Internal server error", "issues": [] } ``` ``` -------------------------------- ### GET /websites/aiinbx/emails/{id} Source: https://docs.aiinbx.com/api-reference/emails/get-email-by-id Retrieves a specific email by its ID. Requires API key authentication. ```APIDOC ## GET /websites/aiinbx/emails/{id} ### Description Retrieve a specific email by its ID using API key authentication. ### Method GET ### Endpoint /websites/aiinbx/emails/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the email to retrieve. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **subject** (string) - The subject of the email. - **from** (string) - The sender's email address. - **to** (string) - The recipient's email address. - **body** (string) - The content of the email. - **timestamp** (string) - The date and time the email was sent. #### Response Example ```json { "subject": "Meeting Confirmation", "from": "sender@example.com", "to": "recipient@example.com", "body": "This is the email body content.", "timestamp": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### GET /domains/{domainId} Source: https://docs.aiinbx.com/api-reference/domains/get-domain-by-id Retrieves detailed information about a specific domain registered with AIinbx. This endpoint requires authentication via a Bearer token. ```APIDOC ## GET /domains/{domainId} ### Description Retrieves detailed information about a specific domain registered with AIinbx. This endpoint requires authentication via a Bearer token. ### Method GET ### Endpoint /domains/{domainId} ### Parameters #### Path Parameters - **domainId** (string) - Required - The unique identifier of the domain #### Query Parameters None #### Request Body None ### Request Example (No request body for this GET request) ### Response #### Success Response (200) - **id** (string) - The unique identifier of the domain. - **createdAt** (string) - The timestamp when the domain was created. - **updatedAt** (string) - The timestamp when the domain was last updated. - **domain** (string) - The domain name. - **verifiedAt** (string) - The timestamp when the domain was verified. Can be null. - **status** (string) - The verification status of the domain. Enum: VERIFIED, PENDING_VERIFICATION, NOT_REGISTERED. - **dnsRecords** (array) - An array of DNS records associated with the domain. Can be null. - **type** (string) - The type of the DNS record (e.g., TXT, CNAME, MX). - **name** (string) - The name of the DNS record. - **value** (string) - The value of the DNS record. - **priority** (number) - The priority of the DNS record (if applicable). - **isVerified** (boolean) - Indicates if the DNS record is verified. - **verificationStatus** (string) - The verification status of the DNS record. Enum: verified, missing, pending. - **lastCheckedAt** (string) - The timestamp when the DNS record was last checked. #### Response Example ```json { "id": "", "createdAt": "", "updatedAt": "", "domain": "", "verifiedAt": "", "status": "VERIFIED", "dnsRecords": [ { "type": "TXT", "name": "", "value": "", "priority": 123, "isVerified": true, "verificationStatus": "verified", "lastCheckedAt": "" } ] } ``` #### Error Response (400) - **message** (string) - The error message. - **code** (string) - The error code. - **issues** (array) - An array of issues that caused the error. #### Error Response Example ```json { "message": "Invalid input data", "code": "BAD_REQUEST", "issues": [] } ``` ``` -------------------------------- ### GET /websites/aiinbx/domains/{id} Source: https://docs.aiinbx.com/api-reference/domains/get-domain-by-id Retrieves a specific domain's details using its unique identifier. This endpoint is part of the AIINBX project and allows for fetching domain information. ```APIDOC ## GET /websites/aiinbx/domains/{id} ### Description Retrieve a domain by its ID ### Method GET ### Endpoint /websites/aiinbx/domains/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the domain to retrieve. ### Request Example ``` GET /websites/aiinbx/domains/example-domain-id ``` ### Response #### Success Response (200) - **domain_name** (string) - The name of the domain. - **id** (string) - The unique identifier of the domain. - **creation_date** (string) - The date the domain was created. #### Response Example ```json { "domain_name": "example.com", "id": "example-domain-id", "creation_date": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Error Handling Source: https://docs.aiinbx.com/api-reference/domains/create-domain This section details the standard error responses from the AIINBX API, including unauthorized access, insufficient permissions, and internal server errors. ```APIDOC ## Error Responses ### Authorization Not Provided Error (401) This error occurs when the API request is made without proper authorization credentials. **Method**: Any **Endpoint**: Any #### Response **Success Response (401)** - **code** (string) - The error code, e.g., "UNAUTHORIZED" - **message** (string) - A description of the error, e.g., "Authorization not provided" - **issues** (array) - An array of specific issues that caused the error. Each issue has a `message` (string). #### Response Example ```json { "code": "UNAUTHORIZED", "message": "Authorization not provided", "issues": [] } ``` ### Insufficient Access Error (403) This error indicates that the authenticated user does not have the necessary permissions to access the requested resource. **Method**: Any **Endpoint**: Any #### Response **Success Response (403)** - **code** (string) - The error code, e.g., "FORBIDDEN" - **message** (string) - A description of the error, e.g., "Insufficient access" - **issues** (array) - An array of specific issues that caused the error. Each issue has a `message` (string). #### Response Example ```json { "code": "FORBIDDEN", "message": "Insufficient access", "issues": [] } ``` ### Internal Server Error (500) This error signifies a problem on the server-side, preventing the request from being processed. **Method**: Any **Endpoint**: Any #### Response **Success Response (500)** - **code** (string) - The error code, e.g., "INTERNAL_SERVER_ERROR" - **message** (string) - A description of the error, e.g., "Internal server error" - **issues** (array) - An array of specific issues that caused the error. Each issue has a `message` (string). #### Response Example ```json { "code": "INTERNAL_SERVER_ERROR", "message": "Internal server error", "issues": [] } ``` ``` -------------------------------- ### Error Handling - Internal Server Error Source: https://docs.aiinbx.com/api-reference/threads/get-thread-by-id Details the structure and example of an internal server error response (500) for the AIINBX website project. ```APIDOC ## Error Handling - Internal Server Error (500) ### Description This endpoint returns a detailed error object when an internal server error occurs. ### Method GET, POST, PUT, DELETE (applicable to any endpoint that might encounter a 500 error) ### Endpoint Any applicable endpoint within the /websites/aiinbx project ### Parameters None ### Request Example ```json { "example": "N/A - This is an error response" } ``` ### Response #### Success Response (N/A) #### Error Response (500) - **code** (string) - Required - An error code indicating the type of error. Example: `INTERNAL_SERVER_ERROR` - **message** (string) - Required - A human-readable description of the error. Example: `Internal server error` - **issues** (array) - Optional - An array of specific issues that contributed to the error. Each issue object contains a `message` (string). #### Response Example ```json { "code": "INTERNAL_SERVER_ERROR", "message": "Internal server error", "issues": [ { "message": "Database connection timed out" } ] } ``` ``` -------------------------------- ### GET /emails/{emailId} Source: https://docs.aiinbx.com/api-reference/emails/get-email-by-id Retrieves a specific email by its unique identifier. This endpoint is useful for fetching detailed information about a single email, including its content, sender, recipients, and timestamps. ```APIDOC ## GET /emails/{emailId} ### Description Retrieves a specific email by its unique identifier. This endpoint is useful for fetching detailed information about a single email, including its content, sender, recipients, and timestamps. ### Method GET ### Endpoint /emails/{emailId} ### Parameters #### Path Parameters - **emailId** (string) - Required - The unique identifier of the email #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **id** (string) - The unique identifier of the email - **createdAt** (string) - Timestamp when the email was created - **messageId** (string) - The unique message ID of the email - **inReplyToId** (string, nullable) - The message ID of the email this is a reply to - **references** (array of strings) - An array of message IDs related to this email thread - **subject** (string, nullable) - The subject line of the email - **text** (string, nullable) - The plain text content of the email - **html** (string, nullable) - The HTML content of the email - **strippedText** (string, nullable) - The plain text content of the email with HTML tags stripped - **strippedHtml** (string, nullable) - The HTML content of the email with HTML tags stripped - **snippet** (string, nullable) - A short snippet or preview of the email content - **fromName** (string, nullable) - The name of the sender - **fromAddress** (string) - The email address of the sender - **toAddresses** (array of strings) - An array of recipient email addresses - **ccAddresses** (array of strings) - An array of CC recipient email addresses - **bccAddresses** (array of strings) - An array of BCC recipient email addresses - **replyToAddresses** (array of strings) - An array of reply-to email addresses - **sentAt** (string, nullable) - Timestamp when the email was sent - **receivedAt** (string, nullable) - Timestamp when the email was received - **direction** (string) - Enum: "INBOUND", "OUTBOUND". The direction of the email. - **status** (string) - Enum: "DRAFT", "QUEUED", "ACCEPTED", "SENT", "RECEIVED", "FAILED", "BOUNCED", "COMPLAINED", "REJECTED", "READ", "ARCHIVED". The status of the email. - **threadId** (string) - The identifier of the thread this email belongs to - **attachments** (array of objects) - An array of attachment objects - **id** (string) - The unique identifier of the attachment - **createdAt** (string) - Timestamp when the attachment was created - **fileName** (string) - The name of the attachment file - **contentType** (string) - The MIME type of the attachment - **sizeInBytes** (number) - The size of the attachment in bytes - **cid** (string, nullable) - The content ID of the attachment (for inline images) - **disposition** (string) - The disposition of the attachment (e.g., 'inline', 'attachment') #### Response Example { "id": "eml_abc123", "createdAt": "2023-01-01T12:00:00Z", "messageId": "", "inReplyToId": null, "references": [], "subject": "Hello World", "text": "This is the plain text content.", "html": "

This is the HTML content.

", "strippedText": "This is the plain text content.", "strippedHtml": "

This is the HTML content.

", "snippet": "This is the pl...", "fromName": "Sender Name", "fromAddress": "sender@example.com", "toAddresses": ["recipient@example.com"], "ccAddresses": [], "bccAddresses": [], "replyToAddresses": [], "sentAt": "2023-01-01T12:05:00Z", "receivedAt": "2023-01-01T12:10:00Z", "direction": "INBOUND", "status": "RECEIVED", "threadId": "thr_xyz789", "attachments": [ { "id": "att_def456", "createdAt": "2023-01-01T12:08:00Z", "fileName": "document.pdf", "contentType": "application/pdf", "sizeInBytes": 102400, "cid": null, "disposition": "attachment" } ] } ``` -------------------------------- ### 404 Not Found Error Source: https://docs.aiinbx.com/api-reference/domains/delete-domain Details the response structure for a 404 Not Found error, indicating a requested resource could not be found. ```APIDOC ## 404 Not Found Error ### Description This endpoint returns a 404 Not Found error when the requested resource does not exist. ### Method GET, POST, PUT, DELETE, etc. (Applicable to any request targeting a specific resource) ### Endpoint Any valid API endpoint ### Parameters N/A ### Request Example N/A ### Response #### Success Response (404) - **code** (string) - The error code. Example: NOT_FOUND - **message** (string) - A descriptive error message. Example: Not found - **issues** (array) - An array of objects, where each object contains a 'message' (string) detailing specific issues. Example: [] #### Response Example ```json { "code": "NOT_FOUND", "message": "Not found", "issues": [] } ``` ``` -------------------------------- ### GET /threads/{threadId} Source: https://docs.aiinbx.com/api-reference/threads/get-thread-by-id Retrieves a specific thread by its unique identifier. This endpoint allows fetching detailed information about a conversation, including all associated emails and their metadata. ```APIDOC ## GET /threads/{threadId} ### Description Retrieves a specific thread by its unique identifier. This endpoint allows fetching detailed information about a conversation, including all associated emails and their metadata. ### Method GET ### Endpoint /threads/{threadId} ### Parameters #### Path Parameters - **threadId** (string) - Required - The unique identifier of the thread #### Query Parameters None #### Request Body None ### Request Example Not applicable for GET requests without a body. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the thread. - **createdAt** (string) - The timestamp when the thread was created. - **subject** (string) - The subject of the thread (nullable). - **emails** (array) - An array of email objects associated with the thread. - **id** (string) - The unique identifier of the email. - **createdAt** (string) - The timestamp when the email was created. - **messageId** (string) - The unique message ID of the email. - **inReplyToId** (string) - The message ID this email is a reply to (nullable). - **references** (array) - An array of message IDs referenced by this email. - **subject** (string) - The subject of the email (nullable). - **text** (string) - The plain text content of the email (nullable). - **html** (string) - The HTML content of the email (nullable). - **strippedText** (string) - The plain text content with HTML stripped (nullable). - **strippedHtml** (string) - The HTML content with HTML stripped (nullable). - **snippet** (string) - A short snippet of the email content (nullable). - **fromName** (string) - The name of the sender (nullable). - **fromAddress** (string) - The email address of the sender. - **toAddresses** (array) - An array of recipient email addresses. - **ccAddresses** (array) - An array of CC recipient email addresses. - **bccAddresses** (array) - An array of BCC recipient email addresses. - **replyToAddresses** (array) - An array of reply-to email addresses. - **sentAt** (string) - The timestamp when the email was sent (nullable). - **receivedAt** (string) - The timestamp when the email was received (nullable). - **direction** (string) - The direction of the email (INBOUND or OUTBOUND). - **status** (string) - The status of the email. - **threadId** (string) - The ID of the thread this email belongs to. - **attachments** (array) - An array of attachment objects associated with the email. #### Response Example ```json { "id": "thread_abc123", "createdAt": "2023-10-27T10:00:00Z", "subject": "Project Update", "emails": [ { "id": "email_xyz789", "createdAt": "2023-10-27T09:55:00Z", "messageId": "", "inReplyToId": null, "references": [], "subject": "Project Update", "text": "Hello team, here is the latest update...", "html": "

Hello team, here is the latest update...

", "strippedText": "Hello team, here is the latest update...", "strippedHtml": "

Hello team, here is the latest update...

", "snippet": "Hello team...", "fromName": "Alice", "fromAddress": "alice@example.com", "toAddresses": ["bob@example.com"], "ccAddresses": [], "bccAddresses": [], "replyToAddresses": [], "sentAt": "2023-10-27T09:55:00Z", "receivedAt": "2023-10-27T09:56:00Z", "direction": "OUTBOUND", "status": "SENT", "threadId": "thread_abc123", "attachments": [] } ] } ``` ``` -------------------------------- ### POST /domains Source: https://docs.aiinbx.com/api-reference/domains/create-domain Creates a new domain within the AIinbx platform. This endpoint allows you to register a domain for further processing or management. ```APIDOC ## POST /domains ### Description Creates a new domain within the AIinbx platform. This endpoint allows you to register a domain for further processing or management. ### Method POST ### Endpoint https://api.aiinbx.com/api/v1/domains ### Parameters #### Query Parameters None #### Path Parameters None #### Request Body - **domain** (string) - Required - The domain name to be registered. Must follow valid domain name patterns. ### Request Example ```json { "domain": "example.com" } ``` ### Response #### Success Response (200) - **domainId** (string) - The unique identifier for the created domain. - **records** (array) - A list of DNS records associated with the domain. - **type** (string) - The type of DNS record (e.g., TXT, CNAME, MX). - **name** (string) - The name of the DNS record. - **value** (string) - The value of the DNS record. - **priority** (number) - The priority for MX records. #### Response Example (200) ```json { "domainId": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "records": [ { "type": "TXT", "name": "@", "value": "v=spf1 include:_spf.google.com ~all", "priority": null } ] } ``` #### Error Response (400) - **message** (string) - A description of the error. - **code** (string) - An error code (e.g., BAD_REQUEST). - **issues** (array) - A list of specific issues encountered. #### Response Example (400) ```json { "code": "BAD_REQUEST", "message": "Invalid input data", "issues": [ { "message": "The provided domain name is not valid." } ] } ``` #### Error Response (401) - **message** (string) - A description of the error. - **code** (string) - An error code (e.g., UNAUTHORIZED). - **issues** (array) - A list of specific issues encountered. #### Response Example (401) ```json { "code": "UNAUTHORIZED", "message": "Invalid API Key provided.", "issues": [] } ``` ```