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)
if 200 <= resp.status_code < 300:
resp_json = resp.json()
print('Custom mapping: ', resp_json)
else:
print('Error: ', str(resp.status_code), resp.text)
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)
if 200 <= resp.status_code < 300:
resp_json = resp.json()
print('Entry: ', resp_json)
else:
print('Error: ', str(resp.status_code), resp.text)
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:
print('Error: ', str(resp.status_code), resp.text)
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.

Team Custom Filters

Team Custom Filters allow you to ignore specific edits that match defined patterns during the editing process for all team members. This is useful for suppressing certain types of corrections that your team doesn't want to see suggested.

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

Team Custom Filter GET

Request Parameters

import requests

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

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

try:
resp = requests.get(url)
if 200 <= resp.status_code < 300:
resp_json = resp.json()
print('Team custom filters: ', resp_json)
else:
print('Error: ', str(resp.status_code), resp.text)
except Exception as e:
print('Error: ', e)

https://api.sapling.ai/api/v1/team/<team_id>/custom_filter?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 filter entries under key custom_filters.

Custom filter entry structure:

{
"id": <str, UUID>, // Opaque id, used for deletion
"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"
"input": <str>, // Input text to match (can be empty string for wildcards)
"output": <str>, // Output text to match (can be empty string for wildcards)
"case_sensitive": <bool> // true or false
}

Team Custom Filter POST

Request Parameters

import requests

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

url = f'https://api.sapling.ai/api/v1/team/{team_id}/custom_filter'
data = {
'key': key,
'inp': 'Patient',
'out': 'The patient',
'case_sensitive': False,
}

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

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

HTTP method: POST

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

key: String
32-character API key.

inp: String
Input text to match. Can be empty string for wildcards.

out: String
Output text to match. Can be empty string for wildcards.

case_sensitive: Boolean
Whether the filter should be case sensitive. Defaults to false.

Response Parameters

JSON, Created Custom Filter Entry Custom Filter Entry Structure:

{
"id": <str, UUID>, // Opaque id, used for deletion
"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"
"input": <str>, // Input text to match
"output": <str>, // Output text to match
"case_sensitive": <bool> // true or false
}

Team Custom Filter DELETE

Request Parameters

import requests

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

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

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

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

HTTP method: DELETE

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

<team_custom_filter_id>: String (UUID)
ID of the custom filter to delete.

key: String
32-character API key

Response Parameters

Empty, HTTP status code 204.