# Create Mismatch Alerts

Creates trailer mismatch observation alerts for the authenticated customer from lists of USDOT numbers and MC numbers.

### **Authentication**

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

### Permissions

The `external-api-mismatch-observations` or `admin` permission is required to access this endpoint.

### **Endpoint**

* **URL:** `https://api.genlogs.io/mismatch-observations`
* **Method:** POST

### **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.

### Request body:

* `usdots` (list of USDOTs, optional or required when `mcs` is not provided): list of the requested USDOT numbers to create a mismatch alert
* `mcs` (list of MCs, optional or required when `usdots` is not provided): list of the requested MC numbers to create a mismatch alert
* `alert_name` (srt, optional): related name of the alert(s) for client use.

### Request Example:

```bash
curl --location 'https://api.genlogs.io/mismatch-observations' \
--header 'access-token: <your-api-token>' \
--header 'x-api-key: <your-x-api-key>' \
--data-raw '{
    "usdots": ["10000","200000","300000"],
    "mcs": ["4000", "5000"],
    "alert_name": "Custom mismatch trailer alert"
}'
```

### **Response:**

* **201 Created:** A JSON object containing the confirmation message and the count of created alerts.
* **400 Bad Request:** If one of the required parameters is missing or incorrect.
* **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:**

201 Created

```json
{
    "message": "Mismatch alerts created successfully.",
    "data": {
        "created": 4
    }
}
```

400 Bad Request

```json
{
  "detail": "At least one USDOT or MC must be provided."
}
```

401 Forbidden

```json
{
  "detail": {
    "message": "Token is missing",
    "subcode": "TOKEN_MISSING"
  }
}
```

403 Forbidden

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

## Create mismatch observation alerts

> Creates one alert row per USDOT or MC value. At least one of \`usdots\` or \`mcs\` must be non-empty. \`alert\_name\` is optional; when omitted or blank, stored as null. \`logos\` is optional and, when present, is stored in \`logos\` and used by mismatch detection. Unknown JSON properties are rejected.<br>

```json
{"openapi":"3.0.3","info":{"title":"Mismatch observation alerts (external API)","version":"1.4.0"},"servers":[{"url":"https://api.genlogs.io"}],"security":[{"Access-Token":[],"X-Api-Key":[]}],"components":{"securitySchemes":{"Access-Token":{"type":"apiKey","in":"header","name":"Access-Token"}},"schemas":{"ExternalMismatchObservationsRequest":{"type":"object","additionalProperties":false,"properties":{"usdots":{"type":"array","items":{"type":"string"},"description":"USDOT numbers (strings). Each non-empty entry creates one alert.","default":[]},"mcs":{"type":"array","items":{"type":"string"},"description":"MC numbers (strings). Each non-empty entry creates one alert.","default":[]},"logos":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Optional trailer logos list. Each value must be a non-empty string. Maximum amount is limited by `MISMATCH_ALERTS_MAX_LOGOS`.\n"},"alert_name":{"type":"string","nullable":true,"description":"Optional display name; omitted or whitespace-only is stored as null."}}}}},"paths":{"/mismatch-observations":{"post":{"summary":"Create mismatch observation alerts","description":"Creates one alert row per USDOT or MC value. At least one of `usdots` or `mcs` must be non-empty. `alert_name` is optional; when omitted or blank, stored as null. `logos` is optional and, when present, is stored in `logos` and used by mismatch detection. Unknown JSON properties are rejected.\n","tags":["Mismatch alerts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalMismatchObservationsRequest"}}}},"responses":{"201":{"description":"Mismatch alerts created successfully.","content":{"application/json":{"schema":{"type":"object","required":["message","data"],"properties":{"message":{"type":"string"},"data":{"type":"object","properties":{"created":{"type":"integer","description":"Number of alerts inserted."}}}}}}}},"400":{"description":"Bad request – validation error or empty usdots/mcs."},"401":{"description":"Unauthorized – Invalid or missing Access-Token."},"403":{"description":"Forbidden – missing permission."},"500":{"description":"Internal Server Error."}}}}}}
```


---

# Agent Instructions: 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:

```
GET https://docs.genlogs.io/alerts/mismatch-alerts/create-mismatch-alerts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
