# Queue

## Poll job status

> Check the status and queue position of an async processing job.

```json
{"openapi":"3.0.3","info":{"title":"MiOffice API","version":"1.0.0"},"servers":[{"url":"https://mioffice.ai","description":"Production"}],"paths":{"/api/queue":{"get":{"operationId":"getJobStatus","summary":"Poll job status","description":"Check the status and queue position of an async processing job.","tags":["Queue"],"parameters":[{"name":"jobId","in":"query","required":true,"schema":{"type":"string"},"description":"Job ID from the 202 response"},{"name":"jobToken","in":"query","required":true,"schema":{"type":"string"},"description":"Job token for authorization"}],"responses":{"200":{"description":"Job status","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["pending","processing","done","error"]},"position":{"type":"integer"},"estimatedWaitMs":{"type":"integer"},"error":{"type":"string"}}}}}},"400":{"description":"Missing jobId or jobToken"},"403":{"description":"Invalid job token"},"404":{"description":"Job not found"}}}}}}
```

## Cancel a queued job

> Cancel a job that hasn't started processing yet.

```json
{"openapi":"3.0.3","info":{"title":"MiOffice API","version":"1.0.0"},"servers":[{"url":"https://mioffice.ai","description":"Production"}],"paths":{"/api/queue":{"delete":{"operationId":"cancelJob","summary":"Cancel a queued job","description":"Cancel a job that hasn't started processing yet.","tags":["Queue"],"parameters":[{"name":"jobId","in":"query","required":true,"schema":{"type":"string"}},{"name":"jobToken","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Job cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"cancelled":{"type":"boolean"}}}}}},"403":{"description":"Invalid job token"},"404":{"description":"Job not found or already completed"}}}}}}
```

## Fetch completed job result

> Download the processed file after job completes. One-time fetch — result is purged after retrieval.

```json
{"openapi":"3.0.3","info":{"title":"MiOffice API","version":"1.0.0"},"servers":[{"url":"https://mioffice.ai","description":"Production"}],"paths":{"/api/queue/result":{"get":{"operationId":"getJobResult","summary":"Fetch completed job result","description":"Download the processed file after job completes. One-time fetch — result is purged after retrieval.","tags":["Queue"],"parameters":[{"name":"jobId","in":"query","required":true,"schema":{"type":"string"}},{"name":"jobToken","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Processed file binary","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"202":{"description":"Job not ready yet — poll /api/queue first"},"403":{"description":"Invalid job token"},"404":{"description":"Job not found"},"410":{"description":"Result expired or already fetched"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mioffice.ai/queue.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
