---
title: "Backfill Vendor Contact Workos Users"
method: POST
path: "/backfills/backfill-vendor-contact-workos-users"
tags: ["internal"]
---

# Backfill Vendor Contact Workos Users

`POST /backfills/backfill-vendor-contact-workos-users`

Create a WorkOS Magic Auth identity (no password — Magic Auth doesn't
need one) for every active vendor contact missing one in the target
environment, in the same shape _ensure_workos_identity and
provision_workos_user use, so a backfilled contact and a lazily-created
one are indistinguishable. Names are passed so the WorkOS dashboard is
legible.

Processes the full contact set in a single request — this can be a long
request on a large tenant. Each email is created independently under its
own try/except, so one bad address can't strand the rest, and failures
are collected rather than aborting the run. A re-run converges to zero
creates because the existence diff against WorkOS is recomputed fresh
each time.

## Request body

- VendorWorkosCredentials — Credentials for the *vendor* WorkOS environment, supplied per request. backend/api/backfills.py is mounted on the main backend, whose module-level workos_client is bound to the main WorkOS environment. The identities this backfill creates need to land in the vendor environment instead, so the target environment's credentials travel with the request rather than living in a second set of env vars on the main service (see helpers/workos_auth.build_workos_client). SecretStr keeps the key out of logs and out of any response that happens to echo the request body.
  - `workos_api_key` string, password, required
  - `workos_client_id` string, required

## Response `200`

Successful Response

- VendorContactWorkosBackfillResponse
  - `created_count` integer, required
  - `already_existed_count` integer, required
  - `failed_count` integer, required
  - `failures` VendorContactWorkosBackfillFailure[], required
    - `email` string, required
    - `error` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/kobaltlabs/apis/fastapi.md) · [All operations](https://skmtc.dev/kobaltlabs/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/kobaltlabs/fastapi/revisions/f85ef083df64/schema)
