# Check Job

Not all our APIs are synchronous, usually a potentially long-running process will be handled by a job. To check whether job is finished or to get any other information, use this query.

* Query: [getJob](https://docs.datasaur.ai/#query-getJob)
* Input: `$jobId: string`
* Response: [Job](https://docs.datasaur.ai/#definition-Job)

### **Example Request via cURL**

```javascript
curl --location --request POST 'https://app.datasaur.ai/graphql' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data-raw '{"operationName":"AutoLabelTokenBasedProjectMutation","variables":{"input":{"labelerEmail":"demo@datasaur.ai","options":{"numberOfFilesPerRequest":0,"serviceProvider":"CUSTOM"},"projectId":"HvdyIL2iwZn","targetAPI":{"endpoint":"https://custom-model.api.com/predict","secretKey":"secret"}}},"query":"mutation AutoLabelTokenBasedProjectMutation($input: AutoLabelTokenBasedProjectInput!) {  result: autoLabelTokenBasedProject(input: $input) {    id  status  progress  }}"}'
```

Below is the more readable version of request body from cURL command above.

```javascript
{
    "operationName": "GetJobQuery",
    "variables": {
        "jobId": "AutoLabelQueue:dcbf6ed3-3841-46c1-8f6a-2affb53ac637"
    },
    "query": "query GetJobQuery($jobId: String!) {  result: getJob(jobId: $jobId) {    id  status  progress  }}"
}
```

* **operationName**: you can fill any alphanumeric string in as the operationName. GetJobQuery is fine as a default. Refer [this page](https://graphql.org/learn/queries/#operation-name) to structure operationName properly.
* **query:** Copy it from cURL example.

### Example Response

Here is the response when you execute the cURL command above.

```javascript
{
    "data": {
        "result": {
            "id": "AutoLabelQueue:dcbf6ed3-3841-46c1-8f6a-2affb53ac637",
            "status": "DELIVERED",
            "progress": 0
        }
    },
    "extensions": {}
}
```

If the status is already **DELIVERED**, then the job is finished.


---

# 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.datasaur.ai/api/get-data/check-job.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.
