Skip to main content

Team Custom Mappings

API key holder must be an admin for the team to access a team's dictionary.

Custom Mappings can be used to enforce specific corrections or capitalization for the following purposes:

  • Brand voice: making sure internal slang is not used in outward communcation
  • Compliance: if there is a specific way to communicate an issue
  • Jargon, product names, specific capitalization

This is the team-wide counterpart to Custom Mappings. If you are not managing a team, you'll want to use Custom Mappings instead.

Team custom mappings will apply to all members of the team. See Team Management for getting the IDs for a particular team.

Custom Mapping GET

Request Parameters

import requests

key = '<api-key>'
team_id = '<TEAM_ID>'

url = f'https://api.sapling.ai/api/v1/team/{team_id}/custom_mapping?key={key}'

try:
resp = requests.get(url)
resp_json = resp.json()
if 200 <= resp.status_code < 300:
print('Custom mapping: ', resp_json)
else:
print('Error: ', resp_json)
except Exception as e:
print('Error: ', e)

https://api.sapling.ai/api/v1/team/<team_id>/custom_mapping?key=<key>

HTTP method: GET

<team_id>: String (UUID)
ID of a Sapling team.

<key>: String
32-character API key.

Response Parameters

JSON array of custom mapping entries under key custom_mappings.

Custom mapping entry structure:

{
"id": <str, UUID>, // Opaque id, used for deletion
"entry": <str>, // Word to match
"mapping": <str>, // Word to suggest as replacement
"case_sensitive": <bool> // true or false
"created_at": <str, date> // e.g. "Wed, 07 Oct 2020 21:15:47 GMT"
"updated_at": <str, date> // e.g. "Wed, 07 Oct 2020 21:15:47 GMT"
}

Custom Mapping POST

Request Parameters

import requests
key = '<api-key>'
team_id = '<TEAM_ID>'

url = f'https://api.sapling.ai/api/v1/team/{team_id}/custom_mapping'
data = {
'key': key,
'entry': 'foobazbar',
'mapping': 'foobarbaz',
'case_sensitive': False,
}

try:
resp = requests.post(url, json=data)
resp_json = resp.json()
if 200 <= resp.status_code < 300:
print('Entry: ', resp_json)
else:
print('Error: ', resp_json)
except Exception as e:
print('Error: ', e)

https://api.sapling.ai/api/v1/team/<team_id>/custom_mapping

HTTP method: POST

<team_id>: String (UUID)
ID of a Sapling team.

key: String
32-character API key.

entry: String
Word to match

There are currently a couple types of regular expression-like options:

  • ^ and $ match the start and end of a sentence, respectively. Example: ^the will only match the at the start of a sentence and can be used to enforce capitalization.
  • # will match a number; example: Gate # will match in Boarding is at Gate 5.

mapping: String
Word to suggest for a match.

You can use # in the resulting expression to substitute a number back in.

case_sensitive: Optional Boolean
Defaults to false. If not case-sensitive, lower case, title case and all-caps will match.

description: Optional String
The description will be shown when the edit is suggested to the end user. If a description field is specified, the user will not have the option to ignore the edit.

Response Parameters

JSON, Created Custom Mapping Entry Custom Mapping Entry Structure:

{
"id": <str, UUID>, // Opaque id, used for deletion
"entry": <str>, // Word to match
"mapping": <str>, // Word to suggest as replacement
"case_sensitive": <bool> // true or false
"created_at": <str, date> // e.g. "Wed, 07 Oct 2020 21:15:47 GMT"
"updated_at": <str, date> // e.g. "Wed, 07 Oct 2020 21:15:47 GMT"
}

Custom Mapping DELETE

Request Parameters

import requests

key = '<api-key>'
team_id = '<TEAM_ID>'
entry_id = '<CUSTOM_MAPPING_ID>'

url = f'https://api.sapling.ai/api/v1/team/{team_id}/custom_mapping/{entry_id}'
data = {
'key': key,
}

try:
resp = requests.delete(url, json=data)
if 200 <= resp.status_code < 300:
print('Success')
else:
resp_json = resp.json()
print('Error: ', resp_json)
except Exception as e:
print('Error: ', e)

https://api.sapling.ai/api/v1/team/<team_id>/custom_mapping/<custom_mapping_id>

HTTP method: DELETE

<team_id>: String (UUID)
ID of a Sapling team.

<custom_mapping_id>: String (UUID)
ID referring to a custom mapping entry.

key: String
32-character API key

Response Parameters

Empty, HTTP status code 204.