Skip to content

Import mappings ​

Generated from DialerDigital/core commit 0fc18008b3c8 — spec openapi/dialer-v1.yaml v0.134.0. Do not edit by hand; see How this reference is built. Download the OpenAPI spec.

Español

CSV import templates (column -> field mapping and parse options), versioned append-only per tenant.

Endpoints ​

MethodPathSummary
GET/v1/import-mappingsThe tenant's CSV import templates, each with its current version
POST/v1/import-mappingsCreate an import template (version 1)
GET/v1/import-mappings/{id}One import template, at its current version
PATCH/v1/import-mappings/{id}Rename a template, or edit it into a NEW version
DELETE/v1/import-mappings/{id}Archive a template
GET/v1/import-mappings/{id}/versionsEvery version of a template, oldest first
GET/v1/import-mappings/{id}/versions/{version}One version of a template
GET/v1/import-mappings/{id}/usesThe imports that used a template, newest first

The tenant's CSV import templates, each with its current version ​

http
GET /v1/import-mappings

By name, the live ones; ?include_archived=true adds the archived. Each template comes with its CURRENT version. Capped at 2 000.

Parameters

NameInTypeRequiredDescription
include_archivedquerybooleanno

Responses

200 ​

The templates.

FieldTypeRequiredDescription
import_mappingsarray of ImportMappingyes
import_mappings[].idstring (uuid)yes
import_mappings[].tenant_idstring (uuid)no
import_mappings[].namestringyes
import_mappings[].archivedbooleanyes
import_mappings[].versionintegeryesThe current version.
import_mappings[].mappingarray of objectyesORDERED list of CSV column -> target field. The order is the file's, because a template is applied to a file whose header signature (its headers, in order) equals the template's.
import_mappings[].mapping[].columnstringyesThe CSV header, as the file spells it.
import_mappings[].mapping[].fieldstringyesThe target field, or skip. One optional group.name dot (contact.phone_e164).
import_mappings[].optionsobject (ImportMappingOptions)yesParse options. Unknown keys are refused.
import_mappings[].options.separatorcomma · semicolon · tabno
import_mappings[].options.default_currencystringno
import_mappings[].version_created_atstring (date-time)no
import_mappings[].created_atstring (date-time)no
import_mappings[].updated_atstring (date-time)no

401 — Unauthorized ​

Missing, unknown or revoked API key (or, on /v1/admin/*, a bad/unset admin token; on webhooks, a bad/missing signature). A dashboard session (ddu_) that a newer login of the same person ended answers the code session_superseded instead (tenant flag single_session_enforced), so the screen can say why it was signed out; a logout, an expired or an unknown token stay unauthorized.

json
{
  "error": {
    "code": "unauthorized",
    "message": "invalid or revoked API key"
  }
}

Create an import template (version 1) ​

http
POST /v1/import-mappings

name is trimmed, not blank, at most 200 characters and unique among the tenant's LIVE templates (409). mapping is an ORDERED list of {column, field}: column is the CSV header as the file spells it (trimmed, at most 200 characters; two entries may not differ only by case or spaces), field the target (a-z, digits and _, at most 64, with one optional group.name dot). The server checks the SHAPE of field, not a closed vocabulary: each consumer of a template fails closed on a field it does not know. At least one entry must map to a field other than skip. options accepts separator (comma, semicolon, tab; default comma) and default_currency (three uppercase letters); any other key is refused. A tenant holds at most 500 live templates (422).

Request body (JSON, required)

FieldTypeRequiredDescription
namestringyes
mappingarray of objectyesORDERED list of CSV column -> target field. The order is the file's, because a template is applied to a file whose header signature (its headers, in order) equals the template's.
mapping[].columnstringyesThe CSV header, as the file spells it.
mapping[].fieldstringyesThe target field, or skip. One optional group.name dot (contact.phone_e164).
optionsobject (ImportMappingOptions)noParse options. Unknown keys are refused.
options.separatorcomma · semicolon · tabno
options.default_currencystringno
json
{
  "name": "Cartera Q3 — export CMS",
  "mapping": [
    {
      "column": "Cuenta",
      "field": "external_ref"
    },
    {
      "column": "Teléfono",
      "field": "phone_primary"
    },
    {
      "column": "Notas",
      "field": "skip"
    }
  ],
  "options": {
    "separator": "semicolon",
    "default_currency": "USD"
  }
}

Responses

201 ​

The template, at version 1.

FieldTypeRequiredDescription
import_mappingobject (ImportMapping)yesA template: its header and its CURRENT version.
import_mapping.idstring (uuid)yes
import_mapping.tenant_idstring (uuid)no
import_mapping.namestringyes
import_mapping.archivedbooleanyes
import_mapping.versionintegeryesThe current version.
import_mapping.mappingarray of objectyesORDERED list of CSV column -> target field. The order is the file's, because a template is applied to a file whose header signature (its headers, in order) equals the template's.
import_mapping.mapping[].columnstringyesThe CSV header, as the file spells it.
import_mapping.mapping[].fieldstringyesThe target field, or skip. One optional group.name dot (contact.phone_e164).
import_mapping.optionsobject (ImportMappingOptions)yesParse options. Unknown keys are refused.
import_mapping.options.separatorcomma · semicolon · tabno
import_mapping.options.default_currencystringno
import_mapping.version_created_atstring (date-time)no
import_mapping.created_atstring (date-time)no
import_mapping.updated_atstring (date-time)no

400 — BadRequest ​

Malformed request (shape/type errors, invalid filters, bad timestamps).

json
{
  "error": {
    "code": "bad_request",
    "message": "from must be RFC-3339"
  }
}

401 — Unauthorized ​

Missing, unknown or revoked API key (or, on /v1/admin/*, a bad/unset admin token; on webhooks, a bad/missing signature). A dashboard session (ddu_) that a newer login of the same person ended answers the code session_superseded instead (tenant flag single_session_enforced), so the screen can say why it was signed out; a logout, an expired or an unknown token stay unauthorized.

json
{
  "error": {
    "code": "unauthorized",
    "message": "invalid or revoked API key"
  }
}

409 — Conflict ​

Invalid state transition, uniqueness conflict, or a seat that is busy/reserved.

json
{
  "error": {
    "code": "conflict",
    "message": "invalid state transition"
  }
}

422 — Unprocessable ​

Shape is fine, semantics are not (broken domain rule).

json
{
  "error": {
    "code": "unprocessable",
    "message": "scheduled_at is closer than the minimum notice for a callback (10 minutes unless the tenant's callback_min_notice_seconds says otherwise)"
  }
}

One import template, at its current version ​

http
GET /v1/import-mappings/{id}

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yesResource UUID. Malformed or cross-tenant ids read as 404.

Responses

200 ​

The template (archived ones too, flagged archived).

FieldTypeRequiredDescription
import_mappingobject (ImportMapping)yesA template: its header and its CURRENT version.
import_mapping.idstring (uuid)yes
import_mapping.tenant_idstring (uuid)no
import_mapping.namestringyes
import_mapping.archivedbooleanyes
import_mapping.versionintegeryesThe current version.
import_mapping.mappingarray of objectyesORDERED list of CSV column -> target field. The order is the file's, because a template is applied to a file whose header signature (its headers, in order) equals the template's.
import_mapping.mapping[].columnstringyesThe CSV header, as the file spells it.
import_mapping.mapping[].fieldstringyesThe target field, or skip. One optional group.name dot (contact.phone_e164).
import_mapping.optionsobject (ImportMappingOptions)yesParse options. Unknown keys are refused.
import_mapping.options.separatorcomma · semicolon · tabno
import_mapping.options.default_currencystringno
import_mapping.version_created_atstring (date-time)no
import_mapping.created_atstring (date-time)no
import_mapping.updated_atstring (date-time)no

401 — Unauthorized ​

Missing, unknown or revoked API key (or, on /v1/admin/*, a bad/unset admin token; on webhooks, a bad/missing signature). A dashboard session (ddu_) that a newer login of the same person ended answers the code session_superseded instead (tenant flag single_session_enforced), so the screen can say why it was signed out; a logout, an expired or an unknown token stay unauthorized.

json
{
  "error": {
    "code": "unauthorized",
    "message": "invalid or revoked API key"
  }
}

404 — NotFound ​

Unknown id, malformed (non-UUID) id OR another tenant's id — RLS returns zero rows, so all three are indistinguishable by design (no existence leak, never a 403 for foreign ids).

json
{
  "error": {
    "code": "not_found",
    "message": "resource not found for this tenant"
  }
}

Rename a template, or edit it into a NEW version ​

http
PATCH /v1/import-mappings/{id}

Send at least one of name, mapping, options. A rename changes the header only. Changing mapping or options appends version n+1 (the one omitted is carried over from the current) and leaves version n exactly as it was: an import may have used it. An edit that changes nothing writes no version. base_version is optional and, when sent, must be the current version — otherwise 409 and nothing is written, so two people editing the same template do not overwrite each other unnoticed. An archived template cannot be edited (409); a template holds at most 1 000 versions (422).

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yesResource UUID. Malformed or cross-tenant ids read as 404.

Request body (JSON, required)

FieldTypeRequiredDescription
namestringno
mappingarray of objectnoORDERED list of CSV column -> target field. The order is the file's, because a template is applied to a file whose header signature (its headers, in order) equals the template's.
mapping[].columnstringyesThe CSV header, as the file spells it.
mapping[].fieldstringyesThe target field, or skip. One optional group.name dot (contact.phone_e164).
optionsobject (ImportMappingOptions)noParse options. Unknown keys are refused.
options.separatorcomma · semicolon · tabno
options.default_currencystringno
base_versionintegerno
json
{
  "base_version": 1,
  "options": {
    "separator": "comma"
  }
}

Responses

200 ​

The template, at its current version after the edit.

FieldTypeRequiredDescription
import_mappingobject (ImportMapping)yesA template: its header and its CURRENT version.
import_mapping.idstring (uuid)yes
import_mapping.tenant_idstring (uuid)no
import_mapping.namestringyes
import_mapping.archivedbooleanyes
import_mapping.versionintegeryesThe current version.
import_mapping.mappingarray of objectyesORDERED list of CSV column -> target field. The order is the file's, because a template is applied to a file whose header signature (its headers, in order) equals the template's.
import_mapping.mapping[].columnstringyesThe CSV header, as the file spells it.
import_mapping.mapping[].fieldstringyesThe target field, or skip. One optional group.name dot (contact.phone_e164).
import_mapping.optionsobject (ImportMappingOptions)yesParse options. Unknown keys are refused.
import_mapping.options.separatorcomma · semicolon · tabno
import_mapping.options.default_currencystringno
import_mapping.version_created_atstring (date-time)no
import_mapping.created_atstring (date-time)no
import_mapping.updated_atstring (date-time)no

400 — BadRequest ​

Malformed request (shape/type errors, invalid filters, bad timestamps).

json
{
  "error": {
    "code": "bad_request",
    "message": "from must be RFC-3339"
  }
}

401 — Unauthorized ​

Missing, unknown or revoked API key (or, on /v1/admin/*, a bad/unset admin token; on webhooks, a bad/missing signature). A dashboard session (ddu_) that a newer login of the same person ended answers the code session_superseded instead (tenant flag single_session_enforced), so the screen can say why it was signed out; a logout, an expired or an unknown token stay unauthorized.

json
{
  "error": {
    "code": "unauthorized",
    "message": "invalid or revoked API key"
  }
}

404 — NotFound ​

Unknown id, malformed (non-UUID) id OR another tenant's id — RLS returns zero rows, so all three are indistinguishable by design (no existence leak, never a 403 for foreign ids).

json
{
  "error": {
    "code": "not_found",
    "message": "resource not found for this tenant"
  }
}

409 — Conflict ​

Invalid state transition, uniqueness conflict, or a seat that is busy/reserved.

json
{
  "error": {
    "code": "conflict",
    "message": "invalid state transition"
  }
}

422 — Unprocessable ​

Shape is fine, semantics are not (broken domain rule).

json
{
  "error": {
    "code": "unprocessable",
    "message": "scheduled_at is closer than the minimum notice for a callback (10 minutes unless the tenant's callback_min_notice_seconds says otherwise)"
  }
}

Archive a template ​

http
DELETE /v1/import-mappings/{id}

Templates are never deleted: the versions an import used are evidence. Archiving frees the name for a new template and takes the template out of the default list; it can no longer be edited or named by an import. Idempotent.

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yesResource UUID. Malformed or cross-tenant ids read as 404.

Responses

204 ​

The template is archived.

401 — Unauthorized ​

Missing, unknown or revoked API key (or, on /v1/admin/*, a bad/unset admin token; on webhooks, a bad/missing signature). A dashboard session (ddu_) that a newer login of the same person ended answers the code session_superseded instead (tenant flag single_session_enforced), so the screen can say why it was signed out; a logout, an expired or an unknown token stay unauthorized.

json
{
  "error": {
    "code": "unauthorized",
    "message": "invalid or revoked API key"
  }
}

404 — NotFound ​

Unknown id, malformed (non-UUID) id OR another tenant's id — RLS returns zero rows, so all three are indistinguishable by design (no existence leak, never a 403 for foreign ids).

json
{
  "error": {
    "code": "not_found",
    "message": "resource not found for this tenant"
  }
}

Every version of a template, oldest first ​

http
GET /v1/import-mappings/{id}/versions

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yesResource UUID. Malformed or cross-tenant ids read as 404.

Responses

200 ​

The versions (capped at 1 000).

FieldTypeRequiredDescription
versionsarray of ImportMappingVersionyes
versions[].mapping_idstring (uuid)yes
versions[].versionintegeryes
versions[].mappingarray of objectyesORDERED list of CSV column -> target field. The order is the file's, because a template is applied to a file whose header signature (its headers, in order) equals the template's.
versions[].mapping[].columnstringyesThe CSV header, as the file spells it.
versions[].mapping[].fieldstringyesThe target field, or skip. One optional group.name dot (contact.phone_e164).
versions[].optionsobject (ImportMappingOptions)yesParse options. Unknown keys are refused.
versions[].options.separatorcomma · semicolon · tabno
versions[].options.default_currencystringno
versions[].created_atstring (date-time)no

401 — Unauthorized ​

Missing, unknown or revoked API key (or, on /v1/admin/*, a bad/unset admin token; on webhooks, a bad/missing signature). A dashboard session (ddu_) that a newer login of the same person ended answers the code session_superseded instead (tenant flag single_session_enforced), so the screen can say why it was signed out; a logout, an expired or an unknown token stay unauthorized.

json
{
  "error": {
    "code": "unauthorized",
    "message": "invalid or revoked API key"
  }
}

404 — NotFound ​

Unknown id, malformed (non-UUID) id OR another tenant's id — RLS returns zero rows, so all three are indistinguishable by design (no existence leak, never a 403 for foreign ids).

json
{
  "error": {
    "code": "not_found",
    "message": "resource not found for this tenant"
  }
}

One version of a template ​

http
GET /v1/import-mappings/{id}/versions/{version}

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yesResource UUID. Malformed or cross-tenant ids read as 404.
versionpathintegeryesThe version number (>= 1). Unknown, malformed or another tenant's reads as 404.

Responses

200 ​

The version, exactly as it was written.

FieldTypeRequiredDescription
versionobject (ImportMappingVersion)yesOne immutable version of a template.
version.mapping_idstring (uuid)yes
version.versionintegeryes
version.mappingarray of objectyesORDERED list of CSV column -> target field. The order is the file's, because a template is applied to a file whose header signature (its headers, in order) equals the template's.
version.mapping[].columnstringyesThe CSV header, as the file spells it.
version.mapping[].fieldstringyesThe target field, or skip. One optional group.name dot (contact.phone_e164).
version.optionsobject (ImportMappingOptions)yesParse options. Unknown keys are refused.
version.options.separatorcomma · semicolon · tabno
version.options.default_currencystringno
version.created_atstring (date-time)no

401 — Unauthorized ​

Missing, unknown or revoked API key (or, on /v1/admin/*, a bad/unset admin token; on webhooks, a bad/missing signature). A dashboard session (ddu_) that a newer login of the same person ended answers the code session_superseded instead (tenant flag single_session_enforced), so the screen can say why it was signed out; a logout, an expired or an unknown token stay unauthorized.

json
{
  "error": {
    "code": "unauthorized",
    "message": "invalid or revoked API key"
  }
}

404 — NotFound ​

Unknown id, malformed (non-UUID) id OR another tenant's id — RLS returns zero rows, so all three are indistinguishable by design (no existence leak, never a 403 for foreign ids).

json
{
  "error": {
    "code": "not_found",
    "message": "resource not found for this tenant"
  }
}

The imports that used a template, newest first ​

http
GET /v1/import-mappings/{id}/uses

One row per import that named the template (?mapping_id= on POST /v1/debts/import or POST /v1/debt-lists/{id}/import): the version it used and how many items went in and failed. Append-only. Capped at 200.

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yesResource UUID. Malformed or cross-tenant ids read as 404.

Responses

200 ​

The uses.

FieldTypeRequiredDescription
usesarray of ImportMappingUseyes
uses[].idstring (uuid)yes
uses[].mapping_idstring (uuid)yes
uses[].versionintegeryes
uses[].list_idstring (uuid) | nullnoThe list, when the import went through /v1/debt-lists/{id}/import.
uses[].importedintegeryes
uses[].failedintegeryesNumber of items that failed.
uses[].created_atstring (date-time)no

401 — Unauthorized ​

Missing, unknown or revoked API key (or, on /v1/admin/*, a bad/unset admin token; on webhooks, a bad/missing signature). A dashboard session (ddu_) that a newer login of the same person ended answers the code session_superseded instead (tenant flag single_session_enforced), so the screen can say why it was signed out; a logout, an expired or an unknown token stay unauthorized.

json
{
  "error": {
    "code": "unauthorized",
    "message": "invalid or revoked API key"
  }
}

404 — NotFound ​

Unknown id, malformed (non-UUID) id OR another tenant's id — RLS returns zero rows, so all three are indistinguishable by design (no existence leak, never a 403 for foreign ids).

json
{
  "error": {
    "code": "not_found",
    "message": "resource not found for this tenant"
  }
}

Nothing in these docs is legal advice — always confirm compliance posture with your own counsel.