---
updatedAt: 2026-07-02T10:57:17.000Z
agentTools:
  projectIndex: https://developer.2hire.io/llms.txt
---

# Retrieve audits

Retrieve audit logs of API calls for specific vehicles in a selected time range

# OpenAPI definition

```json
{
  "openapi": "3.0.2",
  "info": {
    "version": "1.0.0",
    "title": "2hireAsAdapter API - Prod",
    "description": "2hireAsAdapter API lets you manage and control one vehicle and a thousand vehicle alike.",
    "contact": {
      "name": "2hire",
      "email": "info@2hire.io",
      "url": "https://2hire.io"
    }
  },
  "servers": [
    {
      "url": "https://adapter.2hire.io"
    }
  ],
  "tags": [
    {
      "name": "Audit",
      "description": "Retrieve audits"
    }
  ],
  "paths": {
    "/api/v1/audit": {
      "post": {
        "security": [
          {
            "Bearer": []
          }
        ],
        "tags": [
          "Audit"
        ],
        "summary": "Retrieve audits",
        "operationId": "getAudits",
        "description": "Retrieve audit logs of API calls for specific vehicles in a selected time range",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/Audit_Body_Schema"
                  },
                  {
                    "$ref": "#/components/schemas/Audit_Next_Page_Body_Schema"
                  }
                ]
              },
              "examples": {
                "All audits for vehicle": {
                  "value": {
                    "vehicleIds": [
                      "9b2cde89-6e31-4909-b59f-cb6f42c52a5d"
                    ],
                    "from": 1675759570000,
                    "to": 1675759577000
                  }
                },
                "Audit the generic start commands": {
                  "value": {
                    "vehicleIds": [
                      "9b2cde89-6e31-4909-b59f-cb6f42c52a5d"
                    ],
                    "path": [
                      "/api/v1/vehicle/:vehicleId/command/generic/start"
                    ],
                    "from": 1675759500000,
                    "to": 1675759577000
                  }
                },
                "Audit the generic stop commands": {
                  "value": {
                    "vehicleIds": [
                      "9b2cde89-6e31-4909-b59f-cb6f42c52a5d"
                    ],
                    "path": [
                      "/api/v1/vehicle/:vehicleId/command/generic/stop"
                    ],
                    "from": 1675759500000,
                    "to": 1675759577000
                  }
                },
                "Audit the registers": {
                  "value": {
                    "vehicleIds": [
                      "9b2cde89-6e31-4909-b59f-cb6f42c52a5d"
                    ],
                    "path": [
                      "/api/v1/vehicle/register"
                    ],
                    "from": 1675759500000,
                    "to": 1675759577000
                  }
                },
                "Next audits page": {
                  "value": {
                    "page": "b3f0a0c8-7c8d-4d5f-9d3c-8d8e5f6f7f8f"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/SuccessAuditResponse"
          },
          "400": {
            "$ref": "#/components/responses/BadRequestError"
          },
          "401": {
            "$ref": "#/components/responses/AuthenticationError"
          },
          "403": {
            "$ref": "#/components/responses/AuthorizationError"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "responses": {
      "SuccessAuditResponse": {
        "description": "Success Audit Response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SuccessAuditResponse"
            },
            "examples": {
              "Success Audit Response": {
                "value": {
                  "pagination": {
                    "token": "bWluZCB5b3VyIG93biBidXNpbmVzcwo="
                  },
                  "data": [
                    {
                      "id": 101,
                      "vehicleId": "1c1dfc81-36b5-466e-b30f-f64b5ac0fda2",
                      "path": "/api/v1/vehicle/:vehicleId/command/generic/start",
                      "clientId": "TEST_CLIENT_ID",
                      "requestJson": "{}",
                      "responseJson": null,
                      "requestMethod": "PUT",
                      "statusCode": null,
                      "timestamp": 1675759577000,
                      "application": "TEST_APPLICATION",
                      "user": "TEST_USER"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "InternalError": {
        "description": "Internal Error Response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/InternalError"
            },
            "examples": {
              "Internal Error": {
                "value": {
                  "code": "INTERNAL_ERROR",
                  "details": {
                    "cause": "INTERNAL_ERROR"
                  },
                  "errorId": "21127d29-1587-4cc7-92c6-d74b98497e56"
                }
              }
            }
          }
        }
      },
      "BadRequestError": {
        "description": "Bad Request Error Response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BadRequestError"
            },
            "examples": {
              "Bad Format": {
                "summary": "Bad Format Error",
                "value": {
                  "code": "BAD_REQUEST_ERROR",
                  "details": {
                    "cause": "BAD_FORMAT"
                  },
                  "errorId": "21127d29-1587-4cc7-92c6-d74b98497e56"
                }
              }
            }
          }
        }
      },
      "AuthenticationError": {
        "description": "Authentication Error Response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AuthenticationError"
            },
            "examples": {
              "Token expired": {
                "summary": "Token Expired",
                "value": {
                  "code": "AUTHENTICATION_ERROR",
                  "details": {
                    "cause": "TOKEN_EXPIRED"
                  },
                  "errorId": "21127d29-1587-4cc7-92c6-d74b98497e56"
                }
              }
            }
          }
        }
      },
      "AuthorizationError": {
        "description": "Authorization Error Response",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AuthorizationError"
            },
            "examples": {
              "Authorization Error": {
                "value": {
                  "code": "AUTHORIZATION_ERROR",
                  "details": {
                    "cause": "INSUFFICIENT_PERMISSIONS"
                  },
                  "errorId": "21127d29-1587-4cc7-92c6-d74b98497e56"
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "SuccessAuditResponse": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "pagination": {
            "type": "object",
            "description": "A token that allows navigation through pages of older data.",
            "properties": {
              "token": {
                "type": "string"
              }
            }
          },
          "data": {
            "type": "array",
            "description": "Audit history retrieved",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "number"
                },
                "vehicleId": {
                  "nullable": true,
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "clientId": {
                  "type": "string"
                },
                "requestJson": {
                  "nullable": true,
                  "type": "string"
                },
                "responseJson": {
                  "nullable": true,
                  "type": "string"
                },
                "requestMethod": {
                  "type": "string"
                },
                "statusCode": {
                  "nullable": true,
                  "type": "number"
                },
                "timestamp": {
                  "type": "number"
                },
                "application": {
                  "nullable": true,
                  "type": "string"
                },
                "user": {
                  "nullable": true,
                  "type": "string"
                }
              }
            }
          }
        },
        "description": "Audit history was successfully retrieved"
      },
      "InternalErrorCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "INTERNAL_ERROR"
            ]
          }
        }
      },
      "QRCodeNotFoundCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "QR_CODE_NOT_FOUND"
            ]
          }
        }
      },
      "InternalError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Code of the error",
            "enum": [
              "INTERNAL_ERROR"
            ]
          },
          "details": {
            "type": "object",
            "oneOf": [
              {
                "$ref": "#/components/schemas/InternalErrorCause"
              },
              {
                "$ref": "#/components/schemas/QRCodeNotFoundCause"
              }
            ]
          },
          "errorId": {
            "type": "string",
            "description": "uuid generated in order to track logs"
          }
        }
      },
      "BadRequestCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "BAD_REQUEST"
            ]
          }
        }
      },
      "InvalidUUIDCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "INVALID_UUID"
            ]
          }
        }
      },
      "InvalidSignalNameCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "INVALID_SIGNAL_NAME"
            ]
          }
        }
      },
      "BadFormatCause": {
        "type": "object",
        "properties": {
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "BAD_FORMAT"
            ]
          }
        }
      },
      "BadRequestError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Code of the error",
            "enum": [
              "BAD_REQUEST_ERROR"
            ]
          },
          "details": {
            "type": "object",
            "oneOf": [
              {
                "$ref": "#/components/schemas/BadRequestCause"
              },
              {
                "$ref": "#/components/schemas/InvalidUUIDCause"
              },
              {
                "$ref": "#/components/schemas/InvalidSignalNameCause"
              },
              {
                "$ref": "#/components/schemas/BadFormatCause"
              }
            ]
          },
          "errorId": {
            "type": "string",
            "description": "uuid generated in order to track logs"
          }
        }
      },
      "AuthorizationError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Code of the error",
            "enum": [
              "AUTHORIZATION_ERROR"
            ]
          },
          "cause": {
            "type": "string",
            "description": "Specific cause of the error",
            "enum": [
              "INSUFFICIENT_PERMISSIONS",
              "UNKNOWN"
            ]
          },
          "errorId": {
            "type": "string",
            "description": "uuid generated in order to track logs"
          }
        }
      },
      "AuthenticationError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Code of the error",
            "enum": [
              "AUTHENTICATION_ERROR"
            ]
          },
          "details": {
            "type": "object",
            "properties": {
              "cause": {
                "type": "string",
                "description": "Specific cause of the error",
                "enum": [
                  "HEADER_MALFORMED",
                  "HEADER_MISSING",
                  "TOKEN_AUDIENCE_NOT_ALLOWED",
                  "TOKEN_CREATION_FAILED",
                  "TOKEN_EXPIRED",
                  "TOKEN_KEY_ERROR",
                  "TOKEN_SIGN_ERROR",
                  "TOKEN_VERIFICATION_FAILED",
                  "GET_THIRD_PARTY_TOKEN_FAILED"
                ]
              }
            }
          },
          "errorId": {
            "type": "string",
            "description": "uuid generated in order to track logs"
          }
        }
      },
      "Audit_Body_Schema": {
        "type": "object",
        "required": [
          "vehicleIds",
          "from",
          "to"
        ],
        "properties": {
          "vehicleIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of vehicle identifiers"
          },
          "from": {
            "type": "integer",
            "description": "Start of the time range"
          },
          "to": {
            "type": "integer",
            "description": "End of the time range"
          },
          "path": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of paths to filter"
          }
        }
      },
      "Audit_Next_Page_Body_Schema": {
        "type": "object",
        "required": [
          "page"
        ],
        "properties": {
          "page": {
            "type": "string",
            "description": "Pagination token"
          }
        }
      }
    }
  }
}
```