Auth API reference

Auth API · End-Users

patch/v1/apps/{app_id}/end-users/import/mappings/{mapping_id}Auth

Rename, save or change an import mapping.

Naming a draft saves it (it then appears in the list). A changed `mapping` or `columns` is validated as on create. Queued and finished jobs keep the copy they started with. Audited as `users.import_mapping.updated`.

Path parameters

app_id*string

Id of the app.

mapping_id*string · uuid

Import mapping id.

Request body

namestring

New name (naming a draft saves it), or `null` to turn it back into a draft.

Example: "Clerk export (2026)"

mappingobject

Replacement mapping, validated against `columns` (the new ones when both are sent). Mapping v1 (`@repo/user-import`): `{ version: 1, fields: { <target>: { source | sources[], transform?, options? } | { constant } }, metadata?: { columns[], json_column? }, value_maps?: { role: { <file value>: <role name> } } }`. Targets: `email` (required), `username`, `display_name`, `role`, `tenant_slugs`, `external_id`, `email_verified`, `password_hash`, `password_hash_algorithm`, `disabled`. Transforms: `join`, `boolean`, `present`, `split_list`, `value_map`, `hash_algorithm`, `json`, `in_list`. Constants only for `email_verified`, `role`, `disabled`, `tenant_slugs`.

columnsarray

Replacement column names; the fingerprint is recomputed and the mapping re-validated against them.

Response · 200 The updated mapping.

id*string · uuid

Unique identifier of the mapping.

app_id*string · uuid

The Auth app the mapping belongs to.

name*string

Name shown in the console, unique per app. `null` marks a draft: hidden from the list and deleted 7 days after its last edit.

Example: "Clerk export"

mapping*object

Mapping v1 (`@repo/user-import`): `{ version: 1, fields: { <target>: { source | sources[], transform?, options? } | { constant } }, metadata?: { columns[], json_column? }, value_maps?: { role: { <file value>: <role name> } } }`. Targets: `email` (required), `username`, `display_name`, `role`, `tenant_slugs`, `external_id`, `email_verified`, `password_hash`, `password_hash_algorithm`, `disabled`. Transforms: `join`, `boolean`, `present`, `split_list`, `value_map`, `hash_algorithm`, `json`, `in_list`. Constants only for `email_verified`, `role`, `disabled`, `tenant_slugs`.

Example: {"version":1,"fields":{"email":{"source":"primary_email_address"},"external_id":{"source":"id"},"display_name":{"sources":["first_name","last_name"],"transform":"join"},"email_verified":{"source":"verified_email_addresses","transform":"in_list"},"password_hash":{"source":"password_digest"},"password_hash_algorithm":{"sources":["password_hasher"],"transform":"hash_algorithm"},"role":{"source":"role","transform":"value_map"}},"value_maps":{"role":{"administrator":"admin"}}}

columns*array

Column names of the file the mapping was made for.

Example: ["id","first_name","last_name","primary_email_address","verified_email_addresses","password_digest","password_hasher","role"]

header_fingerprint*string

Order-insensitive fingerprint of `columns` (`hf1_…`), computed by the server. Filter the list with it to find a mapping for a file with the same headers.

Example: "hf1_5c3a9e1f0b7d2a64"

created_by*string · uuid

Platform user who created the mapping, when known.

created_at*string · date-time

When the mapping was created (ISO 8601).

updated_at*string · date-time

When the mapping was last changed (ISO 8601).

Example

Request

PATCH https://api.auth.productcraft.co/v1/apps/{app_id}/end-users/import/mappings/{mapping_id}
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json

{
  "name": "Clerk export (2026)",
  "mapping": {},
  "columns": [
    "string"
  ]
}

Response

{
  "id": "00000000-0000-0000-0000-000000000000",
  "app_id": "00000000-0000-0000-0000-000000000000",
  "name": "Clerk export",
  "mapping": {
    "version": 1,
    "fields": {
      "email": {
        "source": "primary_email_address"
      },
      "external_id": {
        "source": "id"
      },
      "display_name": {
        "sources": [
          "first_name",
          "last_name"
        ],
        "transform": "join"
      },
      "email_verified": {
        "source": "verified_email_addresses",
        "transform": "in_list"
      },
      "password_hash": {
        "source": "password_digest"
      },
      "password_hash_algorithm": {
        "sources": [
          "password_hasher"
        ],
        "transform": "hash_algorithm"
      },
      "role": {
        "source": "role",
        "transform": "value_map"
      }
    },
    "value_maps": {
      "role": {
        "administrator": "admin"
      }
    }
  },
  "columns": [
    "id",
    "first_name",
    "last_name",
    "primary_email_address",
    "verified_email_addresses",
    "password_digest",
    "password_hasher",
    "role"
  ],
  "header_fingerprint": "hf1_5c3a9e1f0b7d2a64",
  "created_by": "00000000-0000-0000-0000-000000000000",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}