LogoLogo
  • Welcome
  • Imagine API Studio
  • Get Your API Key
  • Imagine API Reference
  • Getting Started
    • How the API Works
    • API Key Management
    • Selecting the Right API Plan
    • Get Free API Calls
    • Your First API Call
    • Available AI Features in the API
    • Integrating the API into Your Project
    • API Call Billing and Token Usage
  • Troubleshooting
    • Request and Response Formats
    • Error Documentation
    • Troubleshooting Tips
    • Getting Support
  • Core Concepts
    • API Prototyping
    • Creating an Effective Prompt
    • Selecting the Right Style
    • Randomization Control (Seed)
  • Image Generation APIs
    • Introduction
    • Text to Image API
    • Text to PNG API
  • Image Editing APIs
    • Introduction
    • Background Remover API
    • Image Upscale API
    • Generative Fill API
    • AI Resize API
    • Retouch API
  • E-Commerce APIs
    • AI Backgrounds API
  • Video Generation API's
    • Introduction
    • Text to Video API
    • Image to Video API
    • Status API
    • Delete API
Powered by GitBook
On this page
  • Overview
  • Steps to Make an API Call
  • Response Structure
  • Key Considerations
  1. Getting Started

How the API Works

Welcome to Imagine’s suite of powerful APIs, designed to simplify AI-powered image generation, editing, and customization for your projects. Imagine APIs allow developers to access high-quality AI capabilities directly within their applications, enabling seamless integration of advanced image processing features.

Overview

Imagine APIs are built for flexibility and ease of integration, following a consistent structure across all endpoints:

  1. Input and Output Consistency: Each API follows a standardized request and response format. Input types and key parameters are well-defined, allowing you to easily switch between APIs or combine them for complex workflows.

  2. RESTful API: Imagine’s APIs use standard HTTP methods (POST, GET) and accept data via multipart form data. This design ensures compatibility with any programming language that supports HTTP requests.

Steps to Make an API Call

To use Imagine’s APIs effectively, follow these steps:

  1. Authentication: Obtain your API key by signing up on the Imagine platform. Include this key in the Authorization header for each request as Bearer <your-api-token>.

  2. Send Requests: Structure your requests according to each API’s parameters and requirements. Typically, a request will include:

    • API Endpoint URL: Access each API using its unique URL, as detailed in the Imagine API Reference site.

    • Headers: Set up headers for Authorization and Content-Type (if required).

    • Parameters: Specify parameters based on the API’s needs, like prompt, style_id, aspect_ratio, or any customization options.

  3. Receive and Process Responses: Each successful API call returns a structured JSON response, containing the output image or any data associated with your request.

Response Structure

Responses from Imagine APIs are consistent and include:

  • Status Code: Indicates whether the request was successful.

  • Image Output: The generated or edited image file, typically returned as a URL.

  • Error Messages: If a request fails, error messages provide guidance on corrective actions.

Key Considerations

  • Billing: API usage is tracked per request, with usage deducted based on the selected API plan. Refer to the pricing details to understand the credits associated with each request.

  • Error Handling: Each response includes clear error codes to help troubleshoot common issues, from invalid API keys to incorrect parameter formats.

By following these steps, you can fully leverage Imagine APIs to power your applications with AI-driven image generation and editing capabilities. Whether creating new visuals from scratch or enhancing existing content, Imagine provides a comprehensive toolkit to bring your ideas to life.

PreviousGetting StartedNextAPI Key Management

Last updated 6 months ago