Skip to content

How can I validate an AISwapLab request before sending it?

Use the public /openapi.json document to validate route, JSON fields, required headers and response branches before sending a creation request. Then check GET /models for current availability and options. Schema validity prevents many input mistakes, but it does not prove sufficient credits, owned file access or successful generation.

START WITH THE APIAISwapLab team · Editorial methodPublished 2 min read
Open API documentationExplore 67 Image SkillsPrivate keys · Explicit credit approval
Article workflow: Validate the correct body; Verify referenced resources; Quote after normalization.
Workflow diagram: Validate the correct body → Verify referenced resources → Quote after normalization. Read the article for evidence and limits.

Static validation and live checks complement each other

The contract includes different bodies for video, images and chat. Unknown parameters are rejected rather than silently forwarded. Some catalog restrictions are narrower than a general enum: the currently published image rate supports medium quality only. A complete preflight therefore needs both structural validation and live product settings.

What to do next

  1. 01

    Validate the correct body

    Select the schema corresponding to your route and model. Check prompt length, duration bounds, image count or message structure before the user approves the task.

  2. 02

    Verify referenced resources

    For H3 reference fields, use owned IDs from the upload endpoint. A string that resembles a UUID is not proof that the account owns a usable image or video.

  3. 03

    Quote after normalization

    Send the valid intended body to /quotes. Preserve its result and any validation error, with secrets removed, so the user sees a specific correction rather than a generic failure.

A concrete example

Illustrative preflight: a payload is syntactically valid JSON but contains response_format on the image endpoint. The field is outside the customer contract. Remove it rather than assuming the gateway will forward arbitrary provider parameters.

Before you call it ready

  • The selected schema matches the endpoint.
  • Live catalog restrictions are checked.
  • Validation does not trigger media generation.

When to stop or choose another method

If your validator accepts a field that the service rejects, inspect the exact deployed schema and request body. Do not disable validation globally to force an undocumented payload through.

Sources

One task. A recoverable workflow.

Check the contract, approve the quote and retain the job.

Open API documentation