> For the complete documentation index, see [llms.txt](https://api.veratad.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.veratad.com/reporting/audit.md).

# Audit

## Overview

The Veratad Audit API is designed to retrieve an audit trail of all transactions processed on a specific day. Please note that data for a particular day is available only on the next calendar day after 7 am EST.

**Base URL**: `https://reporting.veratad.app`

## Authentication

To authenticate, you'll need the `user` and `pass` for the audit trail you want to inquire about.

***

## Audit Trail Endpoint

### POST `/api/audit`

Fetches an audit trail of transactions for a specified day.

#### Request Parameters

| Parameter | Type   | Description       |
| --------- | ------ | ----------------- |
| `user`    | string | Your API username |
| `pass`    | string | Your API password |
| `day`     | string | Date (YYYY-MM-DD) |

#### Request Example

```json
{
  "user": "yourUsername",
  "pass": "yourPassword",
  "day": "YYYY-MM-DD"
}
```

#### Response

The response is a JSON object containing a data field, which is an array of transaction objects.

#### Response Fields

* data: An array of transaction objects
* id: Transaction ID
* timestamp: Timestamp of the transaction
* service: Service utilized
* reference: Reference code
* user: User who initiated the transaction
* company: Company name
* origin: Origin IP
* path: API path
* flags: Flags (e.g., test, error)
* action: Resulting action
* detail: Additional details
* issues: Any issues encountered (array)
* inputs: Extra input fields

```json
{
  "data": [
    {
      "id": 157929511,
      "timestamp": "2023-09-09T23:59:54",
      // additional fields here
    },
    // additional transactions here
  ]
}
```

#### Error Handling&#x20;

The API could return various errors depending on the situation. Below are the types of errors and their corresponding JSON bodies and HTTP status codes:

Bad Credentials - HTTP Status Code: 401 Unauthorized

```json
{
      "error": "Unauthorized",
      "message": "Invalid username or password."
}
```

Data Not Ready - HTTP Status Code: 404 Not Found

```json
{
      "error": "Data Not Ready",
      "message": "Data for the requested day is not yet available."
}
```

Day Not Available - HTTP Status Code: 404 Not Found

```json
{
      "error": "Day Not Available",
      "message": "Data for the specified day is not available."
}
```

Invalid Date Format - HTTP Status Code: 400 Bad Request

```json
{
      "error": "Invalid Date Format",
      "message": "Date should be in YYYY-MM-DD format."
}
```

Server Error - HTTP Status Code: 500 Internal Server Error

```json
{
      "error": "Server Error",
      "message": "An internal server error occurred."
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://api.veratad.com/reporting/audit.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
