> ## Documentation Index
> Fetch the complete documentation index at: https://docs.legnext.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Postman Collection

> Test and explore Legnext AI API using our official Postman collection

## Quick Start

Get started with our pre-configured Postman collection. Click the button below to fork the collection to your workspace:

<a href="https://www.postman.com/legnext-ai/workspace/legnext-ai-s-workspace/collection/49973316-23452527-b0dc-420a-b21c-cba1d8d5d87a?action=share&source=copy-link&creator=49973316" target="_blank" rel="noopener noreferrer">
  <div
    style={{
display: 'flex',
alignItems: 'center',
gap: '12px',
padding: '16px 24px',
backgroundColor: '#FF6C37',
color: 'white',
borderRadius: '8px',
fontSize: '16px',
fontWeight: '600',
cursor: 'pointer',
border: 'none',
textDecoration: 'none',
width: 'fit-content',
transition: 'background-color 0.2s ease',
marginTop: '16px',
marginBottom: '24px'
}}
  >
    <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
      <path d="M13.527.099C6.955-.744.942 3.9.099 10.473c-.843 6.572 3.8 12.584 10.373 13.428 6.573.843 12.587-3.801 13.428-10.374C24.744 6.955 20.101.943 13.527.099zm2.471 7.485a.855.855 0 0 0-.593.25l-4.453 4.453-.307-.307-.643-.643c4.389-4.376 5.18-4.418 5.996-3.753zm-4.863 4.861l4.44-4.44a.62.62 0 1 1 .847.903l-4.699 4.125-.588-.588zm.33.694l-1.1.238a.06.06 0 0 1-.067-.032.06.06 0 0 1 .01-.073l.645-.645.512.512zm-2.803-.459l1.172-1.172.879.878-1.979.426a.074.074 0 0 1-.085-.039.072.072 0 0 1 .013-.093zm-3.646 6.058a.076.076 0 0 1-.069-.083.077.077 0 0 1 .022-.046h.002l.946-.946 1.222 1.222-2.123-.147zm2.425-1.256a.228.228 0 0 0-.117.256l.203.865a.125.125 0 0 1-.211.117h-.003l-.934-.934-.294-.294-1.98-1.98a.06.06 0 0 1-.017-.059.06.06 0 0 1 .05-.045l2.35-.184 1.938 1.937-1.985.321zm5.279-2.72l-5.164 5.164 1.219 1.219 5.164-5.164-1.219-1.219z" fill="white" />
    </svg>

    <span>Run in Postman</span>
  </div>
</a>

## What's Included

Our Postman collection includes ready-to-use requests for:

### Image Generation

* **Text-to-Image** - Generate images from text descriptions
* **Image-to-Image** - Transform existing images
* **Upscale** - Enhance image resolution
* **Variation** - Create variations of existing images

### Video Generation

* **Video Diffusion** - Generate videos from images or text
* **Video Extend** - Extend video duration
* **Video Upscale** - Enhance video quality

### Task Management

* **Get Task Status** - Check task progress
* **Get Task Result** - Retrieve completed results
* **Cancel Task** - Cancel running tasks

### Account Management

* **Get Balance** - Check your account balance and usage

## Prerequisites

* A Postman account (free or paid)
* Postman Desktop App or Web Client
* A Legnext API key ([Get one here](https://legnext.ai))

## Setup Instructions

### 1. Fork the Collection

Click the "Run in Postman" button above to fork the collection to your workspace.

### 2. Configure API Key

After importing the collection:

1. Open the collection in Postman
2. Go to the "Variables" tab
3. Set the `api_key` variable to your Legnext API key
4. Save the changes

### 3. Start Testing

Select any request from the collection and click "Send" to test the API.

## Collection Features

### Environment Variables

The collection uses variables for easy configuration:

* `base_url` - API base URL (pre-configured)
* `api_key` - Your API key (you need to set this)
* `job_id` - Automatically saved from responses for chaining requests

### Pre-Request Scripts

Some requests include pre-request scripts to:

* Validate required variables
* Generate dynamic data
* Set up request dependencies

### Test Scripts

Responses include test scripts that:

* Validate response status
* Extract and save job IDs
* Check response structure

## Use Cases

### API Exploration

Quickly explore all available endpoints and understand request/response formats without writing code.

### Development Testing

Test API integration during development with easy-to-modify requests and instant feedback.

### Documentation Reference

Use the collection as a living documentation reference with real examples for all endpoints.

### Team Collaboration

Share the collection with your team to ensure everyone uses consistent API patterns.

## Tips and Best Practices

### Save Your Responses

Use Postman's "Save Response" feature to create examples for your team.

### Use Environments

Create different environments (development, staging, production) with different API keys.

### Organize with Folders

The collection is organized by feature - use this structure to quickly find what you need.

### Chain Requests

Use the saved `job_id` variable to chain related requests together (e.g., generate → upscale → get result).

## Troubleshooting

### "Invalid API Key" Error

Make sure you've set your API key in the collection variables:

1. Click on the collection name
2. Go to "Variables" tab
3. Set the `api_key` value
4. Save

### "Request Timeout" Error

Some operations (like video generation) take time. Use the task status endpoint to poll for results instead of waiting for the initial request.

### Variables Not Saving

Make sure you're saving the collection after making changes to variables.

## Public Workspace

Visit our public Postman workspace to explore more:

[View Legnext AI Workspace](https://www.postman.com/legnext-ai/workspace/legnext-ai-s-workspace/collection/49973316-23452527-b0dc-420a-b21c-cba1d8d5d87a?action=share\&source=copy-link\&creator=49973316)

## Need Help?

If you need assistance with the Postman collection, reach out to our support team at [support@legnext.ai](mailto:support@legnext.ai)
