File a request
curl --request POST \
--url https://api.writine.com/api/v1/chat/widget/{siteID}/tickets \
--header 'Content-Type: application/json' \
--header 'Origin: <origin>' \
--data '
{
"email": "<string>",
"subject": "<string>",
"body": "<string>",
"name": "<string>",
"files": [
{
"name": "<string>",
"bytes": 1
}
]
}
'import requests
url = "https://api.writine.com/api/v1/chat/widget/{siteID}/tickets"
payload = {
"email": "<string>",
"subject": "<string>",
"body": "<string>",
"name": "<string>",
"files": [
{
"name": "<string>",
"bytes": 1
}
]
}
headers = {
"Origin": "<origin>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Origin: '<origin>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '<string>',
subject: '<string>',
body: JSON.stringify('<string>'),
name: '<string>',
files: [{name: '<string>', bytes: 1}]
})
};
fetch('https://api.writine.com/api/v1/chat/widget/{siteID}/tickets', 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.writine.com/api/v1/chat/widget/{siteID}/tickets",
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([
'email' => '<string>',
'subject' => '<string>',
'body' => '<string>',
'name' => '<string>',
'files' => [
[
'name' => '<string>',
'bytes' => 1
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Origin: <origin>"
],
]);
$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.writine.com/api/v1/chat/widget/{siteID}/tickets"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"name\": \"<string>\",\n \"files\": [\n {\n \"name\": \"<string>\",\n \"bytes\": 1\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Origin", "<origin>")
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.writine.com/api/v1/chat/widget/{siteID}/tickets")
.header("Origin", "<origin>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"name\": \"<string>\",\n \"files\": [\n {\n \"name\": \"<string>\",\n \"bytes\": 1\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.writine.com/api/v1/chat/widget/{siteID}/tickets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Origin"] = '<origin>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"name\": \"<string>\",\n \"files\": [\n {\n \"name\": \"<string>\",\n \"bytes\": 1\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"result": {
"number": 1,
"subject": "<string>",
"uploads": [
{
"attachment_id": "<string>",
"upload_url": "<string>",
"name": "<string>"
}
]
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}API Reference
File a request
File a request that expects an answer later; it reaches the same inbox as a chat and draws on the same daily allowance. No visitor token is issued, because nothing is read back over the widget session. Files are described here, not uploaded here: the reply carries one presigned destination per file. Authorization and resource ownership are evaluated on every request.
POST
/
api
/
v1
/
chat
/
widget
/
{siteID}
/
tickets
File a request
curl --request POST \
--url https://api.writine.com/api/v1/chat/widget/{siteID}/tickets \
--header 'Content-Type: application/json' \
--header 'Origin: <origin>' \
--data '
{
"email": "<string>",
"subject": "<string>",
"body": "<string>",
"name": "<string>",
"files": [
{
"name": "<string>",
"bytes": 1
}
]
}
'import requests
url = "https://api.writine.com/api/v1/chat/widget/{siteID}/tickets"
payload = {
"email": "<string>",
"subject": "<string>",
"body": "<string>",
"name": "<string>",
"files": [
{
"name": "<string>",
"bytes": 1
}
]
}
headers = {
"Origin": "<origin>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Origin: '<origin>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '<string>',
subject: '<string>',
body: JSON.stringify('<string>'),
name: '<string>',
files: [{name: '<string>', bytes: 1}]
})
};
fetch('https://api.writine.com/api/v1/chat/widget/{siteID}/tickets', 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.writine.com/api/v1/chat/widget/{siteID}/tickets",
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([
'email' => '<string>',
'subject' => '<string>',
'body' => '<string>',
'name' => '<string>',
'files' => [
[
'name' => '<string>',
'bytes' => 1
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Origin: <origin>"
],
]);
$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.writine.com/api/v1/chat/widget/{siteID}/tickets"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"name\": \"<string>\",\n \"files\": [\n {\n \"name\": \"<string>\",\n \"bytes\": 1\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Origin", "<origin>")
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.writine.com/api/v1/chat/widget/{siteID}/tickets")
.header("Origin", "<origin>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"name\": \"<string>\",\n \"files\": [\n {\n \"name\": \"<string>\",\n \"bytes\": 1\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.writine.com/api/v1/chat/widget/{siteID}/tickets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Origin"] = '<origin>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"subject\": \"<string>\",\n \"body\": \"<string>\",\n \"name\": \"<string>\",\n \"files\": [\n {\n \"name\": \"<string>\",\n \"bytes\": 1\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"result": {
"number": 1,
"subject": "<string>",
"uploads": [
{
"attachment_id": "<string>",
"upload_url": "<string>",
"name": "<string>"
}
]
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}{
"success": true,
"result": {
"code": "<string>"
},
"message": "<string>"
}Headers
Must exactly match the website's allowlist. Visitor tokens are bound to this origin.
Path Parameters
Maximum string length:
100Body
application/json