---
title: "Upsert a Canada directory reservation"
method: POST
path: "/internal/upsert-region-reservation"
tags: ["internal"]
---

# Upsert a Canada directory reservation

`POST /internal/upsert-region-reservation`

Service-to-service RPC. Bearer ALLOCATE_USER_ID_SECRET. Canada hosts the directory so /auth/region can see US-home reservations. Hash-only body. Idempotent on email_hash. 404 on US stg/prod. Never send raw email.

## Request body

- UpsertRegionReservationRequest
  - `email_hash` string, required — HMAC-SHA256 peppered email hash as 64 hex chars. Raw email is rejected.
  - `home_region` 'ca' | 'us', required
  - `user_id` integer, required

## Response `200`

written or replayed

- AllocateUserIdResponse
  - `user_id` integer, required

## Other responses

- `400` — invalid body (raw email or bad fields)
- `401` — missing or wrong service secret
- `404` — directory is not hosted on this deploy
- `409` — email_hash already reserved for another user_id

## Changes

- **2026-09-24** `a61b77b30e63` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/rxfoodapp/apis/inneranalytics-mnt-server/changes/internal/upsert-region-reservation/post.md)

---

[API](https://skmtc.dev/rxfoodapp/apis/inneranalytics-mnt-server.md) · [All operations](https://skmtc.dev/rxfoodapp/apis/inneranalytics-mnt-server/llms.txt) · [OpenAPI document](https://skmtc.dev/rxfoodapp/apis/inneranalytics-mnt-server/revisions/a61b77b30e63?raw)
