# Carrier Vetting Assessment

### **Authentication**

* Include your **`Access-Token`** and **`x-api-key`** in the header of your requests.

### Permissions

The `external-api-compliance-rules` permission is required to access this endpoint.

### **Endpoint**

* **URL:**  `https://api.genlogs.io/compliance-rules`
* **Method:** GET

### **Request Parameters**

* **usdot\_number** (string, Required): The USDOT number corresponding to the carrier you would like to review.
* **usdot\_numbers** (string, Required): A comma separated string list with the USDOT numbers corresponding to the carriers you would like to review (if present `usdot_number` will be ignored).

### **Headers**

* **Access-Token**:  (string, required): Access token obtained from the "Create Access Token" endpoint.
* **x-api-key** (string, required): The API key provided by GenLogs.&#x20;

### Request Example:

```bash
curl --location 'https://api.genlogs.io/compliance-rules?usdot_number=100000' \
--header 'access-token: <your-api-token>' \
--header 'x-api-key: <your-x-api-key>'
```

```bash
curl --location 'https://api.genlogs.io/compliance-rules?usdot_numbers=10000,20000,30000' \
--header 'access-token: <your-api-token>' \
--header 'x-api-key: <your-x-api-key>'
```

### **Response:**

* **200 OK:** A JSON object containing the vetting information for the provided carrier.
* **400 Bad Request:** If `usdot_number` or `usdot_numbers` required parameter is missing or invalid.
* **401 Unauthorized:** If the authentication credentials (**Access-Token**) is missing or incorrect.
* **403 Forbidden**: If the permission has not been set to your user.
* **500 Internal Server Error:** If there is an issue on the server that prevents processing the request.

### **Response Body:**

200 OK – Vetting information found for carrier when `usdot_number` is provided

{% code expandable="true" %}

```json
{
   "rules":[
      {
         "rule_result_description":"Carrier has been observed by GenLogs.",
         "status":"pass",
         "category":"GenLogs",
         "rule_order":1
      }
   ],
   "rule_status":{
      "pass":{
         "total":1
      },
      "fail":{
         "total":0
      },
      "review":{
         "total":0
      }
   }
}
```

{% endcode %}

200 OK - Vetting information found or not for carriers when `usdot_numbers` is provided

{% code expandable="true" %}

```json
{
  "results": [
    {
      "usdot_number": "40717",
      "found": false
    },
    {
      "usdot_number": "3888080",
      "found": true,
      "rules": [
        {
          "rule_result_description": "Carrier has NOT been observed by GenLogs.",
          "status": "fail",
          "category": "GenLogs",
          "rule_order": 1
        }
      ],
      "rule_status": {
        "pass": {
          "total": 24
        },
        "fail": {
          "total": 3
        },
        "review": {
          "total": 9
        }
      }
    }
  ]
}
```

{% endcode %}

400 Bad Request

Returned when:

* `usdot_number` is missing, empty, malformed or zero

```json
{
    "detail": "usdot_number is required"
}
```

```json
{
    "detail": "usdot_number must not be empty or zero"
}
```

```json
{
    "message": "Invalid usdot_number value(s): '000000'"
}
```

403 Forbidden

```json
{
    "detail": "User does not have the required permissions to access this resource"
}
```

404 Not Found

```json
{
    "message": "No vetting data found for usdot_number: 100000"
}
```

## Get carrier compliance rules by USDOT (single or batch)

> Returns carrier compliance rules for one or more USDOT numbers.\
> \- Single mode: provide \`usdot\_number\`. The response shape is a single\
> &#x20; object with \`rules\` and \`rule\_status\` and is fully backward compatible\
> &#x20; with the existing API.\
> \- Batch mode: provide \`usdot\_numbers\` as a comma-separated list. The\
> &#x20; response shape is an object with a \`results\` array where each item\
> &#x20; represents one USDOT and includes a \`found\` flag.\
> \
> When both \`usdot\_number\` and \`usdot\_numbers\` are provided, \`usdot\_numbers\` takes precedence and \`usdot\_number\` is ignored.\
> The maximum number of USDOT values allowed in \`usdot\_numbers\` is limited to 50. Requests that exceed this limit return HTTP 400.\
> Each batch result item uses \`found=false\` when no vetting data exists for that USDOT. In that case the item only contains \`usdot\_number\` and \`found\`. When \`found=true\`, \`rules\` and \`rule\_status\` are populated with the same structure as the single-USDOT response.\
> Examples:\
> \- Single:\
> &#x20; \`/compliance-rules?usdot\_number=1234567\`\
> \- Batch:\
> &#x20; \`/compliance-rules?usdot\_numbers=1234567,7654321\`<br>

```json
{"openapi":"3.0.3","info":{"title":"Customer Compliance Rules API","version":"1.0.0"},"servers":[{"url":"https://api.genlogs.io"}],"security":[{"Access-Token":[],"X-Api-Key":[]}],"components":{"securitySchemes":{"Access-Token":{"type":"apiKey","in":"header","name":"Access-Token","description":"JWT provided directly in the Access-Token header.\n"}},"schemas":{"CarrierRulesSingleResponse":{"type":"object","required":["rules","rule_status"],"additionalProperties":false,"properties":{"rules":{"type":"array","items":{"$ref":"#/components/schemas/CarrierRuleItem"}},"rule_status":{"$ref":"#/components/schemas/CarrierRuleStatusCounts"}}},"CarrierRuleItem":{"type":"object","required":["rule_result_description","status","category"],"additionalProperties":false,"properties":{"rule_result_description":{"type":"string"},"status":{"type":"string","description":"PASS / FAIL / REVIEW"},"category":{"type":"string"},"rule_order":{"type":"string"}}},"CarrierRuleStatusCounts":{"type":"object","required":["pass","fail","review"],"additionalProperties":false,"properties":{"pass":{"type":"object","required":["total"],"properties":{"total":{"type":"integer"}}},"fail":{"type":"object","required":["total"],"properties":{"total":{"type":"integer"}}},"review":{"type":"object","required":["total"],"properties":{"total":{"type":"integer"}}}}},"CarrierRulesBatchResponse":{"type":"object","required":["results"],"additionalProperties":false,"properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/CarrierRulesBatchResultItem"}}}},"CarrierRulesBatchResultItem":{"type":"object","required":["usdot_number","found"],"additionalProperties":false,"properties":{"usdot_number":{"type":"string"},"found":{"type":"boolean"},"rules":{"type":"array","items":{"$ref":"#/components/schemas/CarrierRuleItem"}},"rule_status":{"$ref":"#/components/schemas/CarrierRuleStatusCounts"}},"description":"Per-carrier result in a batch response. When found=false, the item only\ncontains usdot_number and found.\n"}}},"paths":{"/compliance-rules":{"get":{"summary":"Get carrier compliance rules by USDOT (single or batch)","description":"Returns carrier compliance rules for one or more USDOT numbers.\n- Single mode: provide `usdot_number`. The response shape is a single\n  object with `rules` and `rule_status` and is fully backward compatible\n  with the existing API.\n- Batch mode: provide `usdot_numbers` as a comma-separated list. The\n  response shape is an object with a `results` array where each item\n  represents one USDOT and includes a `found` flag.\n\nWhen both `usdot_number` and `usdot_numbers` are provided, `usdot_numbers` takes precedence and `usdot_number` is ignored.\nThe maximum number of USDOT values allowed in `usdot_numbers` is limited to 50. Requests that exceed this limit return HTTP 400.\nEach batch result item uses `found=false` when no vetting data exists for that USDOT. In that case the item only contains `usdot_number` and `found`. When `found=true`, `rules` and `rule_status` are populated with the same structure as the single-USDOT response.\nExamples:\n- Single:\n  `/compliance-rules?usdot_number=1234567`\n- Batch:\n  `/compliance-rules?usdot_numbers=1234567,7654321`\n","tags":["Compliance Rules"],"parameters":[{"name":"usdot_number","in":"query","required":false,"description":"Single USDOT number to evaluate. Ignored when `usdot_numbers` is also provided.\n","schema":{"type":"string"}},{"name":"usdot_numbers","in":"query","required":false,"description":"Comma-separated list of USDOT numbers for batch evaluation. When provided, this parameter takes precedence over `usdot_number`.\n","schema":{"type":"string"}}],"responses":{"200":{"description":"Compliance rules retrieved successfully (single or batch).\n- Single: single carrier response (rules + rule_status). - Batch: list of per-carrier results with `found` flags.\n","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/CarrierRulesSingleResponse"},{"$ref":"#/components/schemas/CarrierRulesBatchResponse"}]}}}},"400":{"description":"Bad Request – invalid input, missing required query parameters, or exceeding the maximum allowed number of USDOT values.\n","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"}}}}}},"401":{"description":"Unauthorized – Invalid or missing Access-Token.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"object"}}}}}},"403":{"description":"Forbidden – Company user does not have vetting access permission.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"}}}}}},"404":{"description":"Not Found – no vetting data exists for any of the requested USDOT numbers.\n","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"type":"string"}}}}}}}}}
```
