---
title: "Query Task"
method: GET
path: "/v1/common_task/ai_music/task/query"
---

# Query Task

`GET /v1/common_task/ai_music/task/query`

Query the status and output of an AI music generation task by taskId. `outputs` is empty while the task is in progress; on success, returns the generated audio fileId and access URL.

**Status**: Unfinished tasks are always returned as `running`; finished tasks return `success` or `fail`.

**Credits**: `costCredit` is the actual credit consumed; updated after task success.

## Query parameters

- `taskId` string, required
- `needCloudFrontUrl` boolean

## Headers

- `Topview-Uid` string, required
- `Authorization` string, required

## Response `200`

Query successful

- object
  - `code` string — Business status code; 200 on success
  - `message` string — Status message
  - `result` object — Task query result (ApiAiMusicTaskResponse)
    - `taskId` string — Task ID
    - `status` 'init' | 'running' | 'success' | 'fail' — Task status: init (submitted, not started); running (in progress; unfinished tasks are normalized to running); success; fail
    - `errorMsg` string — Failure reason (returned when status=fail; omitted otherwise)
    - `costCredit` number, float — Actual credits consumed by this task; default 0.00; updated after task success
    - `boardId` string — Associated Board ID (returned when the task originates from a Board)
    - `styles` string — Original style description submitted with the task
    - `enhancePrompt` boolean — Whether style enhancement was enabled on submission
    - `enhancePromptStyle` string — Enhanced style text (returned when enhancePrompt=true and enhancement succeeded; this is the style description actually sent to the generation engine)
    - `outputs` object[] — Generated audio outputs (returned on task success; currently 1 item per generation)
      - `fileId` string — Output audio fileId; reusable in subsequent APIs
      - `url` string — Output audio access URL. When needCloudFrontUrl=true, CloudFront URL is preferred

---

[API](https://skmtc.net/topview/apis/image-character-swap-apis-editable-in-readme.md) · [All operations](https://skmtc.net/topview/apis/image-character-swap-apis-editable-in-readme/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/topview/image-character-swap-apis-editable-in-readme/revisions/83cd46ca7859/schema)
