Rewrite Content
Rewrite a selected span of text generated during Dictation or managed within your application with CONCISE, VERBOSE, or PATIENT_FRIENDLY
curl --request POST \
--url https://sdp.suki.ai/api/v1/content/rewrite \
--header 'Content-Type: application/json' \
--header 'sdp_suki_token: <sdp_suki_token>' \
--header 'sdp_provider_id: <sdp_provider_id>' \
--data '{
"context": {
"selection": {
"start": 16,
"end": 57
},
"surrounding_content": "Patient reports mild intermittent headache for three days."
},
"instruction": "CONCISE",
"selected_text": "mild intermittent headache for three days"
}'import requests
url = "https://sdp.suki.ai/api/v1/content/rewrite"
payload = {
"context": {
"selection": {
"start": 16,
"end": 57
},
"surrounding_content": "Patient reports mild intermittent headache for three days."
},
"instruction": "CONCISE",
"selected_text": "mild intermittent headache for three days"
}
headers = {
"sdp_suki_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {sdp_suki_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
context: {
selection: {start: 16, end: 57},
surrounding_content: 'Patient reports mild intermittent headache for three days.'
},
instruction: 'CONCISE',
selected_text: 'mild intermittent headache for three days'
})
};
fetch('https://sdp.suki.ai/api/v1/content/rewrite', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sdp.suki.ai/api/v1/content/rewrite",
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([
'context' => [
'selection' => [
'start' => 16,
'end' => 57
],
'surrounding_content' => 'Patient reports mild intermittent headache for three days.'
],
'instruction' => 'CONCISE',
'selected_text' => 'mild intermittent headache for three days'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"sdp_suki_token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sdp.suki.ai/api/v1/content/rewrite"
payload := strings.NewReader("{\n \"context\": {\n \"selection\": {\n \"start\": 16,\n \"end\": 57\n },\n \"surrounding_content\": \"Patient reports mild intermittent headache for three days.\"\n },\n \"instruction\": \"CONCISE\",\n \"selected_text\": \"mild intermittent headache for three days\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("sdp_suki_token", "<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))
}HttpResponse<String> response = Unirest.post("https://sdp.suki.ai/api/v1/content/rewrite")
.header("sdp_suki_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"context\": {\n \"selection\": {\n \"start\": 16,\n \"end\": 57\n },\n \"surrounding_content\": \"Patient reports mild intermittent headache for three days.\"\n },\n \"instruction\": \"CONCISE\",\n \"selected_text\": \"mild intermittent headache for three days\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sdp.suki.ai/api/v1/content/rewrite")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["sdp_suki_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"context\": {\n \"selection\": {\n \"start\": 16,\n \"end\": 57\n },\n \"surrounding_content\": \"Patient reports mild intermittent headache for three days.\"\n },\n \"instruction\": \"CONCISE\",\n \"selected_text\": \"mild intermittent headache for three days\"\n}"
response = http.request(request)
puts response.read_body{
"content": "mild headache for 3 days",
"request_id": "trace-123",
"selection": {
"start": 16,
"end": 57
}
}{
"code": 400,
"message": "invalid request"
}{
"code": 401,
"message": "invalid token"
}{
"code": 403,
"message": "forbidden"
}{
"code": 500,
"message": "internal server error"
}Request details
Include the selected text, surrounding content, selection offsets, and one rewrite instruction in the request body. Useinstruction to choose how the selection is rewritten:
| Instruction | What it does |
|---|---|
CONCISE | Shortens the selection while keeping essential details |
VERBOSE | Expands terse wording with more clinical detail |
PATIENT_FRIENDLY | Rewrites the selection in language that is easier for patients to understand |
instructionmust be exactlyCONCISE,VERBOSE, orPATIENT_FRIENDLY. Custom free-form instructions are not supported.- Keep
selected_textandsurrounding_contentat 5,000 Unicode code points or less. selected_textmust appear insidesurrounding_content. If the full field is longer, send a shorter window of text around the selection.
Response processing
A successful call returns a200 OK status with:
content: The rewritten replacement text.selection: Start and end offsets for the span to replace in your UI.request_id: An ID you can share with Technical Support when debugging.
Authorizations
Suki access token (suki_token) from Login or Register. Expires after one hour.
Headers
Optional for standard partners.
Required for:
- Bearer authentication. Use the same
provider_idreturned by the Login or Register API. - Single Auth Token authentication. Include the same
provider_idon every request assdp_provider_id.
"provider-123"
Body
Request body for POST /api/v1/content/rewrite
Surrounding content and selection offsets for the rewrite.
Show child attributes
Show child attributes
Server-defined rewrite instruction. Must be exactly one of CONCISE, VERBOSE, or PATIENT_FRIENDLY.
CONCISE, VERBOSE, PATIENT_FRIENDLY "CONCISE"
Text span to rewrite. Must be a subset of context.surrounding_content when surrounding content is provided. Length must be 1 to 5000 Unicode code points.
1 - 5000"mild intermittent headache for three days"
Response
Request succeeded.
Response body for POST /api/v1/content/rewrite
Rewritten replacement for selected_text.
"mild headache for 3 days"
Server-assigned correlation ID. Share this with Technical Support when debugging a rewrite request.
"trace-123"
Echo of the request selection offsets when provided. Use these offsets to replace the span in your UI.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://sdp.suki.ai/api/v1/content/rewrite \
--header 'Content-Type: application/json' \
--header 'sdp_suki_token: <sdp_suki_token>' \
--header 'sdp_provider_id: <sdp_provider_id>' \
--data '{
"context": {
"selection": {
"start": 16,
"end": 57
},
"surrounding_content": "Patient reports mild intermittent headache for three days."
},
"instruction": "CONCISE",
"selected_text": "mild intermittent headache for three days"
}'import requests
url = "https://sdp.suki.ai/api/v1/content/rewrite"
payload = {
"context": {
"selection": {
"start": 16,
"end": 57
},
"surrounding_content": "Patient reports mild intermittent headache for three days."
},
"instruction": "CONCISE",
"selected_text": "mild intermittent headache for three days"
}
headers = {
"sdp_suki_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {sdp_suki_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
context: {
selection: {start: 16, end: 57},
surrounding_content: 'Patient reports mild intermittent headache for three days.'
},
instruction: 'CONCISE',
selected_text: 'mild intermittent headache for three days'
})
};
fetch('https://sdp.suki.ai/api/v1/content/rewrite', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sdp.suki.ai/api/v1/content/rewrite",
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([
'context' => [
'selection' => [
'start' => 16,
'end' => 57
],
'surrounding_content' => 'Patient reports mild intermittent headache for three days.'
],
'instruction' => 'CONCISE',
'selected_text' => 'mild intermittent headache for three days'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"sdp_suki_token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sdp.suki.ai/api/v1/content/rewrite"
payload := strings.NewReader("{\n \"context\": {\n \"selection\": {\n \"start\": 16,\n \"end\": 57\n },\n \"surrounding_content\": \"Patient reports mild intermittent headache for three days.\"\n },\n \"instruction\": \"CONCISE\",\n \"selected_text\": \"mild intermittent headache for three days\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("sdp_suki_token", "<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))
}HttpResponse<String> response = Unirest.post("https://sdp.suki.ai/api/v1/content/rewrite")
.header("sdp_suki_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"context\": {\n \"selection\": {\n \"start\": 16,\n \"end\": 57\n },\n \"surrounding_content\": \"Patient reports mild intermittent headache for three days.\"\n },\n \"instruction\": \"CONCISE\",\n \"selected_text\": \"mild intermittent headache for three days\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sdp.suki.ai/api/v1/content/rewrite")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["sdp_suki_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"context\": {\n \"selection\": {\n \"start\": 16,\n \"end\": 57\n },\n \"surrounding_content\": \"Patient reports mild intermittent headache for three days.\"\n },\n \"instruction\": \"CONCISE\",\n \"selected_text\": \"mild intermittent headache for three days\"\n}"
response = http.request(request)
puts response.read_body{
"content": "mild headache for 3 days",
"request_id": "trace-123",
"selection": {
"start": 16,
"end": 57
}
}{
"code": 400,
"message": "invalid request"
}{
"code": 401,
"message": "invalid token"
}{
"code": 403,
"message": "forbidden"
}{
"code": 500,
"message": "internal server error"
}