iAsk.Ai - API

An easy-to-use, programmatic access point for iAsk.Ai's suite of features.


IntroductionCopied!

Welcome to the iAsk.Ai API Documentation! This API allows you to integrate powerful capabilities into your applications, enabling you to interact programmatically with our services. Whether you're building applications, automating workflows, or analyzing data, this documentation will guide you through everything you need to get started.

Getting StartedCopied!

To use the API, you'll need to authenticate your requests using a bearer token. The bearer token acts as a key that grants access to the API, ensuring secure communication between your application and our services.

Authentication

The API uses HTTP Bearer Authentication. You must include your API key in the Authorization header of each request. Your API key serves as the bearer token, and it authenticates your identity to the API.

Authorization: Bearer YOUR_API_KEY

Replace YOUR_API_KEY with your actual API key, which you can obtain from the user settings page (https://iask.ai/users/settings) after logging in to the iAsk.Ai website.

Making Your First Request

Here's an example of how to make a simple API request using curl:

curl -X POST \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"stream":false, "prompt":"This is where the query goes..."}' \
  https://api.iask.ai/v1/query

Response Structure

All API responses are returned in JSON format. A typical response will include:

  • Status Code: HTTP status code indicating the success or failure of the request.

  • Data: The data returned by the API, if the request is successful.

  • Error: If the request fails, an error message with details will be included.

Streaming Responses

By default, the API returns a synchronous response and may take some time to respond. You may also stream the response as it’s generated by setting the “stream” key to `true` in the request JSON. The output then sends an SSE (Server-Sent Events) stream containing each token or chunk of text as its generated.

Handling Errors

If something goes wrong, the API will return an appropriate HTTP status code along with an error message. Common status codes include:

  • 200 OK: The request was successful.

  • 400 Bad Request: The request was malformed or invalid.

  • 401 Unauthorized: Authentication failed due to an invalid or missing API key.

  • 500 Internal Server Error: The server encountered an unexpected condition.

Refer to the Error Handling section of this documentation for more details on troubleshooting errors.

Next StepsCopied!

To get started:

  1. Obtain Your API Key: Sign up or log in to your account to get your API key.

  2. Explore the Endpoints: Check out the Reference section to see what functionality is available.

  3. Start Building: Use the provided examples to start integrating our API into your application.

For more detailed information, explore the rest of the documentation, where you'll find comprehensive guides, examples, and reference materials. We're excited to see what you build with the iAsk.Ai API!