Skip to content

⚙️ Custom API

Custom API action allows your AI Assistant to connect directly to external APIs and perform real operations — such as sending data, retrieving information, or updating records.

You can use this action to integrate your assistant with CRMs, databases, dashboards, or any other API-based system.


🧩 Basic Parameters

Each action, including Custom API, has three main parameters:

ParameterDescription
Action NameThe name of your action, shown inside the dashboard.
When To UseA short description that helps the AI decide when to use this action.
EnabledWhether the action is active or disabled.

Create Action Base Fields


🌐 API Configuration

Below the basic parameters, you’ll find additional API-specific fields.

ParameterDescription
Request MethodChoose the HTTP method: GET, POST, PUT, PATCH, or DELETE.
Endpoint URLThe full URL of your API endpoint (e.g. https://yourdomain.com/api/v1/data).

API Method and URL


🔐 Authorization

If your API requires authentication, you can configure it inside the Authorization tab.

FieldDescription
Authorization TypeChoose between None or Custom.
Header NameAuthorization or custom header key used for your token or API key (e.g. X-API-Key).
API KeyThe value of your API key. It will be securely encrypted in Ainisa.

You can also remove or update authorization later.

Authorization Tab


🧾 Headers

Headers can be added manually in the Headers tab.

By default, Ainisa automatically includes these 5 headers in all API requests:

Header KeyDescription
OriginThe Ainisa app origin (https://ainisa.com/).
LocaleThe visitor’s language code (e.g. az, en, ru, etc.).
Content-TypeDefault: application/json.
X-Requested-WithDefault: XMLHttpRequest.
X-User-Id, X-User-HashAuth headers representing the current visitor session. X-User-Id and X-User-Hash are the ones in your platform, NOT ainisa.com

You can add more headers manually if needed.

Headers Tab


🔍 Query Parameters

In the Query Parameters tab, you can define parameters that will be appended to your URL — usually for GET requests.

Each parameter requires:

  • Key
  • Value

Example:
https://api.example.com/data?user_id=123&lang=en

Query Parameters Tab


🧠 Body Parameters

For POST, PUT, and PATCH requests, you can define request body parameters.

Each body parameter includes:

FieldDescription
Input KeyThe parameter name (letters, numbers, _, or -).
Input TypeType of the parameter (text, number, boolean, etc.).
DescriptionA short explanation for the AI (helps it fill parameters properly).
Is ArrayEnable if the parameter is an array (multiple values).

🧩 Note:
The first 3 body parameters (user_email, user_id, user_hash) are automatically sent in all POST, PUT, PATCH requests by default. They are your users parameters in your platform, NOT ainisa.com

Body Parameters Tab


🧪 Testing the API

After you’ve configured all fields, you can test the API before saving.

  • Click Test Before Saving to send a sample request.
  • Ainisa will display the response (status, body, and headers) to help you confirm everything works.
  • If the test is successful, click Save.

✅ Summary

StepAction
1Add action name, usage, and enable it
2Choose API method and endpoint
3Configure authorization if needed
4Add headers, query, and body parameters
5Test API connection
6Save and use inside your AI Assistant

💡 Example Use Cases

  • Fetch live data (e.g. weather, crypto prices, or inventory)
  • Create leads or send contact form data to CRM
  • Update user status or purchase record
  • Trigger actions in your internal API