> ## Documentation Index
> Fetch the complete documentation index at: https://docs.parcha.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Jobs by Case ID

> Retrieve all jobs associated with a specific case ID for a given agent

This endpoint retrieves all jobs associated with a specific case ID for a given agent.

## Endpoint

`GET /getJobsByCaseId`

## Parameters

<ParamField query="case_id" type="string" required>
  The unique identifier of the case.
</ParamField>

<ParamField query="agent_key" type="string" required>
  The key of the agent associated with the jobs.
</ParamField>

<ParamField query="include_check_results" type="boolean" default="false">
  Whether to include detailed check results in the response.
</ParamField>

<ParamField query="include_status_messages" type="boolean" default="false">
  Whether to include status messages in the response.
</ParamField>

## Response

The response follows the `JobsResponse` model, which typically includes:

<ResponseField name="jobs" type="array">
  An array of job objects associated with the case ID.
</ResponseField>

<ResponseField name="count" type="int">
  The total number of jobs associated with the case ID.
</ResponseField>

Each job object may include:

<ResponseField name="id" type="string">
  The unique identifier of the job.
</ResponseField>

<ResponseField name="status" type="string">
  The current status of the job (e.g., "pending", "completed", "failed").
</ResponseField>

<ResponseField name="created_at" type="string">
  The timestamp when the job was created.
</ResponseField>

<ResponseField name="updated_at" type="string">
  The timestamp when the job was last updated.
</ResponseField>

<ResponseField name="input_payload" type="object">
  The input payload used for the job.
</ResponseField>

<ResponseField name="check_results" type="array">
  An array of check results, if `include_check_results` is true.
</ResponseField>

Deprecation Note: The `status_messages` field will be deprecated in future versions.

<ResponseField name="status_messages" type="array">
  An array of status messages, if `include_status_messages` is true.
</ResponseField>

## Error Responses

<ResponseField name="error" type="string">
  A description of the error that occurred.
</ResponseField>

| Status Code | Description                  |
| ----------- | ---------------------------- |
| 404         | Case or jobs not found       |
| 403         | Unauthorized access to agent |
| 500         | Internal server error        |

## Example Request

```bash theme={null}
curl -X GET 'https://api.parcha.ai/api/v1/getJobsByCaseId?case_id=123456&agent_key=your_agent_key&include_check_results=true&include_status_messages=true' \
-H 'Authorization: Bearer YOUR_API_KEY'
```

## Example Response

```json theme={null}
{
  "jobs": [
    {
      "id": "job_789012",
      "status": "completed",
      "created_at": "2023-06-15T10:00:00Z",
      "updated_at": "2023-06-15T10:05:00Z",
      "check_results": [
        {
          "id": "check_345678",
          "type": "business_verification",
          "status": "completed",
          "result": {
            "verified": true,
            "risk_score": 25
          }
        }
      ],
      "status_messages": [
        {
          "timestamp": "2023-06-15T10:01:00Z",
          "message": "Business verification check started"
        },
        {
          "timestamp": "2023-06-15T10:05:00Z",
          "message": "Business verification check completed"
        }
      ]
    }
  ]
}
```

## Notes

* This endpoint requires authentication. Make sure to include your API key in the request headers.
* The user must have access to the specified agent to retrieve the jobs.
* The `include_check_results` and `include_status_messages` parameters allow you to control the level of detail in the response. Setting these to `true` may increase the response size and processing time.
* The structure of check results may vary depending on the type of checks performed in the jobs.


## OpenAPI

````yaml GET /getJobsByCaseId
openapi: 3.0.0
info:
  title: Parcha API
  version: 1.0.0
  description: API for managing Parcha jobs and checks
servers:
  - url: https://api.parcha.ai/api/v1
    description: Agent Hub API server
  - url: https://demo.parcha.ai/api/v1
    description: Sandbox API server
  - url: https://us1.parcha.ai/api/v1
    description: Legacy API server
  - url: http://{your-company-domain}.parcha.ai/api/v1
    description: Custom Enterpris server (your company's API server)
security:
  - bearerAuth: []
paths:
  /getJobsByCaseId:
    get:
      summary: Get jobs by case ID
      parameters:
        - name: case_id
          in: query
          required: true
          schema:
            type: string
        - name: agent_key
          in: query
          required: true
          schema:
            type: string
        - name: include_check_results
          in: query
          schema:
            type: boolean
        - name: include_status_messages
          in: query
          schema:
            type: boolean
      responses:
        '200':
          description: Jobs retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobsResponse'
        '401':
          description: Unauthorized
      security:
        - bearerAuth: []
components:
  schemas:
    JobsResponse:
      type: object
      properties:
        jobs:
          type: array
          items:
            type: object
        count:
          type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key obtained from your Parcha account settings. Include as Bearer
        token in the Authorization header.

````