# Submit Store Compliance Records

`POST /api/v1/store-compliance-records`

Marks stores compliant or not compliant on one of your brand's compliance programs, one row per store, such as a monthly PCI sync from the system that tracks your scans. Requires the `create` ability, on a token belonging to an HQ (franchisor) account with the manage compliance permission, on an account that uses Store compliance.

A batch is all or nothing: if any row is invalid (a store no `uuid` or `external_id` matches, a store that isn't active, the same store twice, a bad status or date), the request is refused with a 422 naming each bad row, and nothing is stored. One request takes one row per store and up to 2,000 rows; to mark several months for a store, send one request per month. Like every `/api/v1` endpoint, this one shares the limit of 60 requests per minute per user, and answers `429` with a `Retry-After` header beyond it.

Marks are kept, never overwritten: a store's latest mark is the one that counts, and a wrong one is corrected by sending the right one. Sending a mark the store already has for that period (same status, and the same note, reference and expiry date where you send them) writes nothing new; it is counted as unchanged and recorded as confirmed, so a sync that runs every week shows it is still running without adding to the store's history.

Each requirement renews in one of five ways, which decides the dates a row takes:
- **Monthly** or **Quarterly**: a mark answers one calendar month or quarter. Send `period`
  as `YYYY-MM` (monthly) or `YYYY-Qn` (quarterly, `2026-Q4`), or leave it out for the period
  containing `effective_on`. Send it when marking a period that has already closed, such as
  November on December 2. A period that hasn't started is refused.

- **Yearly**: a compliant mark holds for a year from `effective_on`.
- **Expiry date per store**: a compliant mark needs `expires_on`, the day it lapses.
- **Never**: a mark stands until the next one.

A requirement can need evidence with each compliant mark, such as the permit or the inspection report. Files can't be sent through this endpoint, so a compliant mark there must carry `reference`, the number of the document it rests on; HQ attaches the file itself on the store's compliance page.

A requirement that isn't monthly or quarterly refuses `period`, and one without an expiry date per store refuses `expires_on`, so a row is never stored for a different date than the one it names. Dates follow your brand's own calendar: `effective_on` defaults to today, and a later date is refused. A blank `period`, `effective_on` or `expires_on` is refused rather than read as today; a blank `note` or `reference` is read as not sent.

## Request body

```json
{
    "program": "PCI",
    "records": [
        {
            "location": "1024",
            "status": "compliant",
            "period": "2026-11",
            "reference": "SM-20261124-1024"
        },
        {
            "location": "1025",
            "status": "not_compliant",
            "period": "2026-11",
            "note": "Scan failed; rescan booked."
        }
    ]
}
```

## Example request

```bash
curl -X POST "https://app.franchisesee.com/api/v1/store-compliance-records" \
  -H "Authorization: Bearer $FRANCHISESEE_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "program": "PCI",
    "records": [
        {
            "location": "1024",
            "status": "compliant",
            "period": "2026-11",
            "reference": "SM-20261124-1024"
        },
        {
            "location": "1025",
            "status": "not_compliant",
            "period": "2026-11",
            "note": "Scan failed; rescan booked."
        }
    ]
}'
```

## Responses

### 200 Marks stored.

```json
{
    "program": {
        "id": "019a4f1e-7c2b-7d3e-9a10-4b5c6d7e8f90",
        "name": "PCI"
    },
    "requirement": {
        "id": "019a4f1e-7c2b-7d3e-9a10-4b5c6d7e8f91",
        "name": "PCI compliant"
    },
    "total": 2,
    "written_count": 1,
    "unchanged_count": 1
}
```

### 401 Authentication failed or missing.

```json
{
    "message": "Unauthenticated."
}
```

### 403 The token lacks the required ability or the caller is not permitted.

```json
{
    "message": "This API token does not have the 'create' ability."
}
```

### 422 The batch was refused and nothing was stored. `errors` names each bad row by its position in `records`.

```json
{
    "message": "No store has this uuid or external_id. (and 1 more error)",
    "errors": {
        "records.1.location": [
            "No store has this uuid or external_id."
        ],
        "records.2.period": [
            "This requirement renews monthly: send the month as YYYY-MM, such as 2026-11."
        ]
    }
}
```
