API Key

An API Key is a unique identifier used to authenticate requests made from your application to CalStudio APIs. Think of it as a secure access badge that allows your application to use CalStudio’s services safely. At CalStudio we allow you to use our APIs using the API keys that we generate for you.

Creating Your API Keys

You can generate and manage your API keys directly from your CalStudio Dashboard. Steps to Create an API Key:
  1. Log in or Sign up
    • Visit calstudio.com and log in with your credentials.
    • If you don’t have an account, sign up to access the dashboard.
  2. Navigate to API Keys Section
    • On the left-hand sidebar of the dashboard, locate and click on API Keys.
  3. Generate a New Key
    • Click the Create API Key button.
    • Provide a label or description (optional, but recommended to help you identify usage).
    • Your new API key will be generated instantly.
  4. Copy and Store Securely
    • Copy the key and keep it in a secure location.

Best Practices for Using API Keys

  • Keep it secret → Never share your key publicly (e.g., GitHub, client-side code).
  • Restrict usage → Apply restrictions (IP, domain, or service-level) when possible.
  • Rotate regularly → Regenerate keys periodically and update your applications.
  • Revoke if compromised → Immediately delete and regenerate your key if you suspect unauthorized use.
Main dashboard interface

How to use your API Key

Make POST requests to https://calstudio.com/getbackResponse with the following parameters in the request body:
  • prompt: Your input text
  • apiKey: Your API key
  • appName: Name of your app
  • fileUrl (optional): URL to a file (image, PDF, or other document) for the AI to analyze. Only one file per request is supported.
const axios = require("axios");

async function getAppResponse() {
  try {
    const response = await axios.post("https://calstudio.com/getbackResponse", {
      prompt: "Hello, how are you?",
      apiKey: "your_api_key_here",
      appName: "your_app_name", // replace with your app name
    });

    console.log(response.data);
    // {
    //   message: "App's response",
    //   status: 200,
    //   success: true
    // }
  } catch (error) {
    console.error("Error:", error);
  }
}

Working with files

You can provide file URLs in your API requests to have the AI analyze images, PDFs, and other documents. Simply include the fileUrl parameter with a valid, publicly accessible URL to your file. Note: Only one file per request is supported.
const axios = require("axios");

async function getAppResponseWithFile() {
  try {
    const data = {
      prompt: "What does this image show?",
      apiKey: "your_api_key_here",
      appName: "your_app_name",
      fileUrl: "https://example.com/path/to/your/image.jpg",
    };

    const response = await axios.post(
      "https://calstudio.com/getbackResponse",
      data
    );

    console.log(response.data);
    // {
    //   message: "App's response about the image",
    //   status: 200,
    //   success: true
    // }
  } catch (error) {
    console.error("Error:", error);
  }
}