Create completion
curl --request POST \
--url https://api.dimedove.com/v1/apps/{app_id}/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fast": false,
"knowledge_search": true,
"metadata": {
"first_name": "Alex",
"page": "pricing"
},
"prompt": "Write a friendly one-sentence welcome message for a new customer.",
"stream": false
}
'import requests
url = "https://api.dimedove.com/v1/apps/{app_id}/completions"
payload = {
"fast": False,
"knowledge_search": True,
"metadata": {
"first_name": "Alex",
"page": "pricing"
},
"prompt": "Write a friendly one-sentence welcome message for a new customer.",
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fast: false,
knowledge_search: true,
metadata: {first_name: 'Alex', page: 'pricing'},
prompt: 'Write a friendly one-sentence welcome message for a new customer.',
stream: false
})
};
fetch('https://api.dimedove.com/v1/apps/{app_id}/completions', 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://api.dimedove.com/v1/apps/{app_id}/completions",
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([
'fast' => false,
'knowledge_search' => true,
'metadata' => [
'first_name' => 'Alex',
'page' => 'pricing'
],
'prompt' => 'Write a friendly one-sentence welcome message for a new customer.',
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.dimedove.com/v1/apps/{app_id}/completions"
payload := strings.NewReader("{\n \"fast\": false,\n \"knowledge_search\": true,\n \"metadata\": {\n \"first_name\": \"Alex\",\n \"page\": \"pricing\"\n },\n \"prompt\": \"Write a friendly one-sentence welcome message for a new customer.\",\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.dimedove.com/v1/apps/{app_id}/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fast\": false,\n \"knowledge_search\": true,\n \"metadata\": {\n \"first_name\": \"Alex\",\n \"page\": \"pricing\"\n },\n \"prompt\": \"Write a friendly one-sentence welcome message for a new customer.\",\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dimedove.com/v1/apps/{app_id}/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fast\": false,\n \"knowledge_search\": true,\n \"metadata\": {\n \"first_name\": \"Alex\",\n \"page\": \"pricing\"\n },\n \"prompt\": \"Write a friendly one-sentence welcome message for a new customer.\",\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"created_at": 1717027200,
"id": "cmpl_a1b2c3d4e5f6a7b8c9d0e1f2",
"object": "completion",
"status": "completed",
"text": "Welcome aboard, Alex. We're thrilled to have you and are here to help whenever you need us."
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}Completions
Create completion
Generates a one-shot text completion using the app’s agent configuration. Unlike the conversation endpoints, this does not create or belong to a conversation. It produces a single piece of text from your instruction, grounded in the agent’s business context. Supports both streaming (Server-Sent Events) and non-streaming (JSON) modes.
Create completion
curl --request POST \
--url https://api.dimedove.com/v1/apps/{app_id}/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fast": false,
"knowledge_search": true,
"metadata": {
"first_name": "Alex",
"page": "pricing"
},
"prompt": "Write a friendly one-sentence welcome message for a new customer.",
"stream": false
}
'import requests
url = "https://api.dimedove.com/v1/apps/{app_id}/completions"
payload = {
"fast": False,
"knowledge_search": True,
"metadata": {
"first_name": "Alex",
"page": "pricing"
},
"prompt": "Write a friendly one-sentence welcome message for a new customer.",
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fast: false,
knowledge_search: true,
metadata: {first_name: 'Alex', page: 'pricing'},
prompt: 'Write a friendly one-sentence welcome message for a new customer.',
stream: false
})
};
fetch('https://api.dimedove.com/v1/apps/{app_id}/completions', 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://api.dimedove.com/v1/apps/{app_id}/completions",
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([
'fast' => false,
'knowledge_search' => true,
'metadata' => [
'first_name' => 'Alex',
'page' => 'pricing'
],
'prompt' => 'Write a friendly one-sentence welcome message for a new customer.',
'stream' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.dimedove.com/v1/apps/{app_id}/completions"
payload := strings.NewReader("{\n \"fast\": false,\n \"knowledge_search\": true,\n \"metadata\": {\n \"first_name\": \"Alex\",\n \"page\": \"pricing\"\n },\n \"prompt\": \"Write a friendly one-sentence welcome message for a new customer.\",\n \"stream\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.dimedove.com/v1/apps/{app_id}/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fast\": false,\n \"knowledge_search\": true,\n \"metadata\": {\n \"first_name\": \"Alex\",\n \"page\": \"pricing\"\n },\n \"prompt\": \"Write a friendly one-sentence welcome message for a new customer.\",\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dimedove.com/v1/apps/{app_id}/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fast\": false,\n \"knowledge_search\": true,\n \"metadata\": {\n \"first_name\": \"Alex\",\n \"page\": \"pricing\"\n },\n \"prompt\": \"Write a friendly one-sentence welcome message for a new customer.\",\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"created_at": 1717027200,
"id": "cmpl_a1b2c3d4e5f6a7b8c9d0e1f2",
"object": "completion",
"status": "completed",
"text": "Welcome aboard, Alex. We're thrilled to have you and are here to help whenever you need us."
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"param": "<string>",
"code": "<string>"
}
}Authorizations
Body
application/json
The instruction describing the text to generate. The completion is produced in your app's agent voice, grounded in its configured business context. Treated strictly as a generation instruction, not as a command that can change the agent's behavior. Maximum 32,000 characters.
Minimum string length:
1Response
OK

