Update Phrase Replacement Config - Uplift AI API Docs
Update phrase replacement config
Example JSON Payload
{
"phraseReplacements": [
{
"phrase": "سیونگز اکاؤنٹ",
"replacement": "savings account"
},
{
"phrase": "Isabion",
"replacement": "ایزابیان"
},
{
"phrase": "Meezan bank",
"replacement": "میزان بینک"
}
]
}
cURL Command
curl --request POST \
--url https://api.upliftai.org/v1/synthesis/phrase-replacement-config/{configId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"phraseReplacements": [
{
"phrase": "<string>",
"replacement": "<string>"
}
]
}
'
Python Example
import requests
url = "https://api.upliftai.org/v1/synthesis/phrase-replacement-config/{configId}"
payload = { "phraseReplacements": [
{
"phrase": "<string>",
"replacement": "<string>"
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
PHP Example
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.upliftai.org/v1/synthesis/phrase-replacement-config/{configId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phraseReplacements' => [
[
'phrase' => '<string>',
'replacement' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Go Example
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.upliftai.org/v1/synthesis/phrase-replacement-config/{configId}"
payload := strings.NewReader("{\n \"phraseReplacements\": [\n {\n \"phrase\": \"<string>\",\n \"replacement\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Response Structure
Successful Response
{
"configId": "<string>",
"phraseReplacements": [
{
"phrase": "<string>",
"replacement": "<string>"
}
]
}
Error Responses
{
"message": "<string>"
}
{
"message": "Rate limit exceeded, please try again later"
}
Authorizations
- Authorization: API key with format "Bearer sk_api_..."
Path Parameters
- configId: Required ID of the configuration to update.
Body
- phraseReplacements: Required array of phrase replacement rules.