> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/azfar-imtiaz/PayPulse-Cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Get rental invoice

> Retrieve the details of a specific rental invoice by ID.

<Note>
  This endpoint is not currently used in the PayPulse app. It is available for direct API access and future use.
</Note>

## Authentication

All requests to this endpoint must include a valid JWT in the `Authorization` header.

```
Authorization: Bearer <token>
```

## Path parameters

<ParamField path="type" type="string" required>
  The invoice type. Must be `rental` for this endpoint.
</ParamField>

<ParamField path="invoice_id" type="string" required>
  The unique identifier of the rental invoice to retrieve.
</ParamField>

## Response

<ResponseField name="message" type="string">
  A human-readable confirmation message. Example: `"Invoice details retrieved successfully!"`
</ResponseField>

<ResponseField name="code" type="number">
  HTTP status code. `200` on success, `204` when the invoice does not exist.
</ResponseField>

<ResponseField name="data" type="object | null">
  The full invoice item as stored in DynamoDB. `null` when status is `204`. Fields present depend on what was parsed from the invoice PDF. Common fields include:

  <Expandable title="properties" defaultOpen>
    <ResponseField name="InvoiceID" type="string">
      Unique identifier for the invoice.
    </ResponseField>

    <ResponseField name="UserID" type="string">
      The ID of the user who owns this invoice.
    </ResponseField>

    <ResponseField name="due_date_month" type="string">
      The month portion of the invoice due date.
    </ResponseField>

    <ResponseField name="due_date_year" type="string">
      The year portion of the invoice due date.
    </ResponseField>
  </Expandable>
</ResponseField>

## Error responses

| Status | Error code              | Description                                                                        |
| ------ | ----------------------- | ---------------------------------------------------------------------------------- |
| `204`  | —                       | No invoice found for the given `invoice_id` and authenticated user. Body is empty. |
| `400`  | `MISSING_FIELDS`        | The `type` or `invoice_id` path parameter is absent.                               |
| `401`  | `INVALID_CREDENTIALS`   | The `Authorization` header is missing or the token is invalid.                     |
| `401`  | `TOKEN_EXPIRED`         | The JWT has expired.                                                               |
| `502`  | `DEPENDENCY_FAILURE`    | A downstream dependency (DynamoDB) returned an error.                              |
| `500`  | `INTERNAL_SERVER_ERROR` | An unexpected server-side error occurred.                                          |

Error responses follow this structure:

```json theme={null}
{
  "error": {
    "code": "MISSING_FIELDS",
    "message": "Missing fields in URL"
  }
}
```

<RequestExample>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://api.paypulse.io/v1/invoices/rental/inv_abc123 \
    --header 'Authorization: Bearer <token>'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "message": "Invoice details retrieved successfully!",
    "code": 200,
    "data": {
      "InvoiceID": "inv_abc123",
      "UserID": "user_xyz789",
      "due_date_month": "3",
      "due_date_year": "2025"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": "TOKEN_EXPIRED",
      "message": "Expired token."
    }
  }
  ```
</ResponseExample>
