Ricky logorickyDocs

Set the field mappings of a template

PUT
/templates/{template_id}/field-mappings

Replaces every mapping of the template. Each one names a variable of variables and a contact field; a custom field must be the organization’s.

Scope: templates:write.

Authorization

bearerAuth
headerAuthorizationBearer <token>

An organization API key, rky_live_…, created in Settings → API. Send it only from a server.

template_id*string

Template ID.

Match^[0-9]{1,32}$
Idempotency-Key?string

Optional. A value you choose, unique per logical write, 8–200 characters: a UUID or an ID from your system such as order-10482-ready. Retrying with the same key and body replays the first response instead of repeating the write.

Length8 <= length <= 200

Request Body

application/json
  1. body

The contact fields that fill the template’s variables when Ricky sends it.

mappings*array<>

Every mapping of the template; the ones not sent are removed. Send [] to remove all.

Itemsitems <= 100

Response Body

Success.

application/json
  1. response
data*

The contact fields that fill a template’s variables when Ricky sends it to a contact. They apply to the template’s name and language in its business account.

curl -X PUT 'https://getricky.ai/api/v1/templates/string/field-mappings' \  -H 'Idempotency-Key: order-10482-ready' \  -H 'Content-Type: application/json' \  -d '{  "mappings": [    {      "component": "body",      "key": "1",      "source": {        "kind": "native",        "field": "first_name"      }    },    {      "component": "body",      "key": "2",      "source": {        "kind": "custom",        "field_id": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d"      }    }  ]}'
{  "data": {    "template_id": "1234567890123456",    "variables": [      {        "component": "body",        "key": "1",        "name": "{{1}}"      }    ],    "mappings": [      {        "component": "body",        "key": "1",        "source": {          "kind": "native",          "field": "first_name"        }      }    ]  }}