MaxDay AI
API consoleAPI v1

MaxDay AI API documentation

Complete an App Run in minutes with these four steps.

  1. Prepare an API Key Obtain credentials and configure the API Base URL.
  2. Get a Project ID, select an App, and read its parameters Select a project and one of its published Apps, then prepare the inputs currently declared by that App.
  3. Create an App Run Submit the App ID, Project ID, and inputJson, then save the returned Run ID.
  4. Get the Run result Poll with the Run ID and read outputs or errors after the Run enters a terminal state.

Step 1: Prepare an API Key

Before integrating, prepare:

  • API Base URL: https://api.maxday.ai/bio/dramas/v1;
  • An active API Key from the API Key page, in a format similar to ak_live_....

Store them as server-side environment variables:

export MAXDAY_API_BASE_URL="https://api.maxday.ai/bio/dramas/v1"
export MAXDAY_API_KEY="ak_live_REPLACE_WITH_YOUR_API_KEY"

The complete API Key is shown only once. Store it in a server-side secret manager or environment variable. Never commit it to a source repository or put it in browser code, URLs, logs, or error-reporting data.

Step 2: Get a Project ID, select an App, and read its parameters

Get a Project ID

Every Run belongs to a project. Balance checks and charges also belong to that project. The data.id returned by the project list or creation API is the Project ID. Pass it unchanged as projectId when creating a Run.

Reuse an existing Project ID instead of creating a new project for every task. List the projects available to the current account:

curl --fail-with-body --connect-timeout 10 --max-time 30 \
  "${MAXDAY_API_BASE_URL}/openapi/v1/projects" \
  --header "Authorization: Bearer ${MAXDAY_API_KEY}"

Success response:

{
  "code": 200,
  "message": "success",
  "data": [
    {
      "id": "PROJECT_ID",
      "name": "Advertising Assets"
    }
  ]
}

Select an existing project and save its Project ID:

export MAXDAY_PROJECT_ID="PROJECT_ID"

See List projects for all fields. Create a project only when the list returns data: [] and no usable project exists:

curl --fail-with-body --connect-timeout 10 --max-time 60 \
  --request POST "${MAXDAY_API_BASE_URL}/openapi/v1/projects" \
  --header "Authorization: Bearer ${MAXDAY_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Advertising Assets"
  }'

Success response:

{
  "code": 200,
  "message": "success",
  "data": {
    "id": "PROJECT_ID",
    "name": "Advertising Assets"
  }
}

After creation, save the returned Project ID and reuse it for later tasks:

export MAXDAY_PROJECT_ID="PROJECT_ID"

List published Apps in the project

Use the selected Project ID to list the project's published Apps:

curl --fail-with-body --connect-timeout 10 --max-time 30 \
  "${MAXDAY_API_BASE_URL}/openapi/v1/apps?projectId=${MAXDAY_PROJECT_ID}&pageNo=1&pageSize=20" \
  --header "Authorization: Bearer ${MAXDAY_API_KEY}"

The data.items in a successful response contains App summaries for the current page. Select an App and save its appId. If the page returns items: [], query the next page or check the publication status in the MaxDay App Store. See List published Apps for all fields.

Read App parameters

Before creating a Run, read the inputs, outputs, steps, examples, and estimated price of the App's current published version:

curl --fail-with-body --connect-timeout 10 --max-time 30 \
  "${MAXDAY_API_BASE_URL}/openapi/v1/apps/REPLACE_WITH_YOUR_APP_ID" \
  --header "Authorization: Bearer ${MAXDAY_API_KEY}"

Every App may declare different inputs. Build inputJson from the data.inputs returned by App details. Fields used later in this guide are only examples.

Step 3: Create an App Run

curl --fail-with-body --connect-timeout 10 --max-time 60 \
  --request POST "${MAXDAY_API_BASE_URL}/openapi/v1/app-runs" \
  --header "Authorization: Bearer ${MAXDAY_API_KEY}" \
  --header "Content-Type: application/json" \
  --data "{
    \"appId\": \"REPLACE_WITH_YOUR_APP_ID\",
    \"projectId\": \"${MAXDAY_PROJECT_ID}\",
    \"inputJson\": {
      \"outfit_prompt\": \"Fashion outfit flat lay on white background\",
      \"character_image\": {
        \"url\": \"https://example.com/a.png\"
      }
    }
  }"

Success response:

{
  "code": 200,
  "message": "success",
  "data": {
    "runId": "e8f4c7a135d64211a8d2c0019b57ef63",
    "estimatedPrice": "12.50000000"
  }
}

Save the returned Run ID:

export MAXDAY_RUN_ID="e8f4c7a135d64211a8d2c0019b57ef63"

The creation API does not deduplicate requests. Do not blindly retry the POST after a network interruption; doing so may create another Run and incur another charge. After confirming creation, use the Run ID to query the result.

Step 4: Get the Run result

Runs execute asynchronously. Query the status with the Run ID returned by the creation API:

curl --fail-with-body --connect-timeout 10 --max-time 30 \
  --retry 4 --retry-all-errors --retry-delay 1 \
  "${MAXDAY_API_BASE_URL}/openapi/v1/app-runs/${MAXDAY_RUN_ID}" \
  --header "Authorization: Bearer ${MAXDAY_API_KEY}"

Example response after successful completion:

{
  "code": 200,
  "message": "success",
  "data": {
    "runId": "e8f4c7a135d64211a8d2c0019b57ef63",
    "status": "succeeded",
    "progress": 100,
    "estimatedPrice": "12.50000000",
    "actualPrice": "12.50000000",
    "createdAt": 1786759200000,
    "endTime": 1786759260000,
    "outputs": [
      {
        "name": "Final video",
        "url": "https://example.com/out.mp4",
        "type": "video"
      }
    ],
    "steps": [],
    "error": null
  }
}

Poll every 2 seconds for the first 30 seconds, then gradually increase the interval to 5–10 seconds. Stop polling after entering any terminal state:

StatusMeaning
succeededAll required steps succeeded
partial_successSome steps succeeded and produced usable results
failedExecution failed; inspect data.error in the response
canceledExecution was canceled

Do not automatically retry the POST that creates a Run. The result-query GET may be retried with backoff after network errors, HTTP 429, or temporary server errors. Prefer the delay in the Retry-After header.

Complete examples

The examples below support Node.js 18+, Python 3.9+, and Java 11+. Update inputJson to match the App details response.

const baseUrl = "https://api.maxday.ai/bio/dramas/v1";
// API Key and reusable Project ID.
const apiKey = process.env.MAXDAY_API_KEY;
const projectId = process.env.MAXDAY_PROJECT_ID;
// Target App ID obtained from the project's App list or platform.
const appId = "REPLACE_WITH_YOUR_APP_ID";

if (!apiKey || !projectId) {
  throw new Error("Set MAXDAY_API_KEY and MAXDAY_PROJECT_ID");
}

// Wait for the specified number of milliseconds.
const sleep = (milliseconds) =>
  new Promise((resolve) => setTimeout(resolve, milliseconds));

// Send a request and handle HTTP and application errors consistently.
async function request(path, options = {}) {
  // Response object for the current request.
  const response = await fetch(`${baseUrl}${path}`, {
    ...options,
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
      ...options.headers,
    },
    signal: AbortSignal.timeout(60_000),
  });
  // Raw response text.
  const text = await response.text();
  // Parsed response JSON.
  let body;

  try {
    body = JSON.parse(text);
  } catch {
    throw new Error(text || `HTTP ${response.status}`);
  }

  if (!response.ok || body.message !== "success") {
    throw new Error(body.data?.error?.message || body.message || `HTTP ${response.status}`);
  }

  return body.data;
}

// Execute one complete App Run flow.
async function runApp() {
  // Public parameter definition of the current App.
  const app = await request(`/openapi/v1/apps/${appId}`);
  console.log("App inputs:", app.inputs);

  // Newly created Run.
  const createdRun = await request("/openapi/v1/app-runs", {
    method: "POST",
    body: JSON.stringify({
      appId,
      projectId,
      inputJson: {
        outfit_prompt: "Fashion outfit flat lay on white background",
        character_image: { url: "https://example.com/a.png" },
      },
    }),
  });
  // Wait at most one hour.
  const deadline = Date.now() + 60 * 60 * 1000;
  // Current polling interval, initially two seconds.
  let pollDelay = 2_000;

  while (Date.now() < deadline) {
    // Latest status of the current Run.
    const run = await request(`/openapi/v1/app-runs/${createdRun.runId}`);

    if (["succeeded", "partial_success"].includes(run.status)) {
      return run;
    }
    if (["failed", "canceled"].includes(run.status)) {
      throw new Error(run.error?.message || `Run ${run.status}`);
    }

    await sleep(pollDelay);
    pollDelay = Math.min(10_000, pollDelay + 1_000);
  }

  throw new Error(`Timed out waiting for Run ${createdRun.runId}`);
}

runApp().then(console.log).catch(console.error);

API summary

ItemValue
Base URLhttps://api.maxday.ai/bio/dramas/v1
Authentication headerAuthorization: Bearer <API_KEY>
POST Content-Typeapplication/json
Successful creationHTTP 201
Successful queryHTTP 200
Application errorHTTP 200, top-level message is not success, details are in data.error

Next steps