curl --request POST \
--url https://api.ofauth.com/v2/access/chats/:userId/messages \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--header 'x-connection-id: <api-key>' \
--data '
{
"isForwardedMessage": false,
"text": "",
"replyToMessageId": "<string>",
"mediaItems": [],
"isLockedText": false,
"price": 0,
"previewMediaCount": 0,
"releaseForms": {
"users": [],
"partners": [],
"guests": []
},
"userTags": [],
"isMarkdown": true
}
'import requests
url = "https://api.ofauth.com/v2/access/chats/:userId/messages"
payload = {
"isForwardedMessage": False,
"text": "",
"replyToMessageId": "<string>",
"mediaItems": [],
"isLockedText": False,
"price": 0,
"previewMediaCount": 0,
"releaseForms": {
"users": [],
"partners": [],
"guests": []
},
"userTags": [],
"isMarkdown": True
}
headers = {
"apiKey": "<api-key>",
"x-connection-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
apiKey: '<api-key>',
'x-connection-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
isForwardedMessage: false,
text: '',
replyToMessageId: '<string>',
mediaItems: [],
isLockedText: false,
price: 0,
previewMediaCount: 0,
releaseForms: {users: [], partners: [], guests: []},
userTags: [],
isMarkdown: true
})
};
fetch('https://api.ofauth.com/v2/access/chats/:userId/messages', 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.ofauth.com/v2/access/chats/:userId/messages",
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([
'isForwardedMessage' => false,
'text' => '',
'replyToMessageId' => '<string>',
'mediaItems' => [
],
'isLockedText' => false,
'price' => 0,
'previewMediaCount' => 0,
'releaseForms' => [
'users' => [
],
'partners' => [
],
'guests' => [
]
],
'userTags' => [
],
'isMarkdown' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apiKey: <api-key>",
"x-connection-id: <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://api.ofauth.com/v2/access/chats/:userId/messages"
payload := strings.NewReader("{\n \"isForwardedMessage\": false,\n \"text\": \"\",\n \"replyToMessageId\": \"<string>\",\n \"mediaItems\": [],\n \"isLockedText\": false,\n \"price\": 0,\n \"previewMediaCount\": 0,\n \"releaseForms\": {\n \"users\": [],\n \"partners\": [],\n \"guests\": []\n },\n \"userTags\": [],\n \"isMarkdown\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiKey", "<api-key>")
req.Header.Add("x-connection-id", "<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://api.ofauth.com/v2/access/chats/:userId/messages")
.header("apiKey", "<api-key>")
.header("x-connection-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"isForwardedMessage\": false,\n \"text\": \"\",\n \"replyToMessageId\": \"<string>\",\n \"mediaItems\": [],\n \"isLockedText\": false,\n \"price\": 0,\n \"previewMediaCount\": 0,\n \"releaseForms\": {\n \"users\": [],\n \"partners\": [],\n \"guests\": []\n },\n \"userTags\": [],\n \"isMarkdown\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ofauth.com/v2/access/chats/:userId/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apiKey"] = '<api-key>'
request["x-connection-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"isForwardedMessage\": false,\n \"text\": \"\",\n \"replyToMessageId\": \"<string>\",\n \"mediaItems\": [],\n \"isLockedText\": false,\n \"price\": 0,\n \"previewMediaCount\": 0,\n \"releaseForms\": {\n \"users\": [],\n \"partners\": [],\n \"guests\": []\n },\n \"userTags\": [],\n \"isMarkdown\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"text": "<string>",
"createdAt": "<string>",
"media": [
{
"id": 123,
"convertedToVideo": true,
"canView": true,
"hasError": true,
"createdAt": "<string>",
"isReady": true,
"releaseForms": [
{
"id": 123,
"name": "<string>",
"partnerSource": "<string>",
"type": "<string>",
"user": {
"view": "<string>",
"id": 123,
"name": "<string>",
"username": "<string>",
"isVerified": true,
"avatar": "<string>",
"avatarThumbs": {
"c50": "<string>",
"c144": "<string>"
},
"ivStatus": "<string>",
"isFromGuest": true
}
}
],
"duration": 123,
"hasCustomPreview": true,
"videoSources": {
"240": "<string>",
"720": "<string>"
},
"files": {
"full": {
"url": "<string>",
"sources": [
{
"url": "<string>",
"width": 123,
"height": 123,
"type": "<string>"
}
],
"width": 123,
"height": 123,
"size": 123
},
"thumb": {
"url": "<string>",
"width": 123,
"height": 123,
"size": 123
},
"preview": {
"url": "<string>",
"options": [
{
"url": "<string>",
"width": 123,
"height": 123,
"type": "<string>"
}
],
"width": 123,
"height": 123,
"size": 123
},
"squarePreview": {
"url": "<string>",
"width": 123,
"height": 123,
"size": 123
}
}
}
],
"mediaCount": 123,
"isMediaReady": true,
"price": 123,
"isFree": true,
"lockedText": true,
"queueId": 123,
"cancelSeconds": 123
}Send a chat message
Send one direct message to one user.
Permission Required: messages:write
curl --request POST \
--url https://api.ofauth.com/v2/access/chats/:userId/messages \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--header 'x-connection-id: <api-key>' \
--data '
{
"isForwardedMessage": false,
"text": "",
"replyToMessageId": "<string>",
"mediaItems": [],
"isLockedText": false,
"price": 0,
"previewMediaCount": 0,
"releaseForms": {
"users": [],
"partners": [],
"guests": []
},
"userTags": [],
"isMarkdown": true
}
'import requests
url = "https://api.ofauth.com/v2/access/chats/:userId/messages"
payload = {
"isForwardedMessage": False,
"text": "",
"replyToMessageId": "<string>",
"mediaItems": [],
"isLockedText": False,
"price": 0,
"previewMediaCount": 0,
"releaseForms": {
"users": [],
"partners": [],
"guests": []
},
"userTags": [],
"isMarkdown": True
}
headers = {
"apiKey": "<api-key>",
"x-connection-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
apiKey: '<api-key>',
'x-connection-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
isForwardedMessage: false,
text: '',
replyToMessageId: '<string>',
mediaItems: [],
isLockedText: false,
price: 0,
previewMediaCount: 0,
releaseForms: {users: [], partners: [], guests: []},
userTags: [],
isMarkdown: true
})
};
fetch('https://api.ofauth.com/v2/access/chats/:userId/messages', 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.ofauth.com/v2/access/chats/:userId/messages",
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([
'isForwardedMessage' => false,
'text' => '',
'replyToMessageId' => '<string>',
'mediaItems' => [
],
'isLockedText' => false,
'price' => 0,
'previewMediaCount' => 0,
'releaseForms' => [
'users' => [
],
'partners' => [
],
'guests' => [
]
],
'userTags' => [
],
'isMarkdown' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apiKey: <api-key>",
"x-connection-id: <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://api.ofauth.com/v2/access/chats/:userId/messages"
payload := strings.NewReader("{\n \"isForwardedMessage\": false,\n \"text\": \"\",\n \"replyToMessageId\": \"<string>\",\n \"mediaItems\": [],\n \"isLockedText\": false,\n \"price\": 0,\n \"previewMediaCount\": 0,\n \"releaseForms\": {\n \"users\": [],\n \"partners\": [],\n \"guests\": []\n },\n \"userTags\": [],\n \"isMarkdown\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiKey", "<api-key>")
req.Header.Add("x-connection-id", "<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://api.ofauth.com/v2/access/chats/:userId/messages")
.header("apiKey", "<api-key>")
.header("x-connection-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"isForwardedMessage\": false,\n \"text\": \"\",\n \"replyToMessageId\": \"<string>\",\n \"mediaItems\": [],\n \"isLockedText\": false,\n \"price\": 0,\n \"previewMediaCount\": 0,\n \"releaseForms\": {\n \"users\": [],\n \"partners\": [],\n \"guests\": []\n },\n \"userTags\": [],\n \"isMarkdown\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ofauth.com/v2/access/chats/:userId/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apiKey"] = '<api-key>'
request["x-connection-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"isForwardedMessage\": false,\n \"text\": \"\",\n \"replyToMessageId\": \"<string>\",\n \"mediaItems\": [],\n \"isLockedText\": false,\n \"price\": 0,\n \"previewMediaCount\": 0,\n \"releaseForms\": {\n \"users\": [],\n \"partners\": [],\n \"guests\": []\n },\n \"userTags\": [],\n \"isMarkdown\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"text": "<string>",
"createdAt": "<string>",
"media": [
{
"id": 123,
"convertedToVideo": true,
"canView": true,
"hasError": true,
"createdAt": "<string>",
"isReady": true,
"releaseForms": [
{
"id": 123,
"name": "<string>",
"partnerSource": "<string>",
"type": "<string>",
"user": {
"view": "<string>",
"id": 123,
"name": "<string>",
"username": "<string>",
"isVerified": true,
"avatar": "<string>",
"avatarThumbs": {
"c50": "<string>",
"c144": "<string>"
},
"ivStatus": "<string>",
"isFromGuest": true
}
}
],
"duration": 123,
"hasCustomPreview": true,
"videoSources": {
"240": "<string>",
"720": "<string>"
},
"files": {
"full": {
"url": "<string>",
"sources": [
{
"url": "<string>",
"width": 123,
"height": 123,
"type": "<string>"
}
],
"width": 123,
"height": 123,
"size": 123
},
"thumb": {
"url": "<string>",
"width": 123,
"height": 123,
"size": 123
},
"preview": {
"url": "<string>",
"options": [
{
"url": "<string>",
"width": 123,
"height": 123,
"type": "<string>"
}
],
"width": 123,
"height": 123,
"size": 123
},
"squarePreview": {
"url": "<string>",
"width": 123,
"height": 123,
"size": 123
}
}
}
],
"mediaCount": 123,
"isMediaReady": true,
"price": 123,
"isFree": true,
"lockedText": true,
"queueId": 123,
"cancelSeconds": 123
}Authorizations
Requires a connection via the x-connection-id header.
Path Parameters
^\d+$Body
Whether this is a forwarded message
Text content. Supports markdown by default. See Text Formatting Guide.
10000Reply to an existing chat message
1Media references to attach. Accepts vault media IDs, upload references (mediaUploadId), or http(s) URLs. See mediaItems reference.
OnlyFans media ID
x > 0Whether text is locked behind paywall (defaults to false).
Price to unlock message content (0 for free)
0 <= x <= 200How many items in mediaItems should be previews. Uses the first N items from left to right.
x >= 0Release form participants
Show child attributes
Show child attributes
Users to tag
OnlyFans user ID
x > 0Whether to parse text as markdown (default: true). See Text Formatting Guide.
Was this page helpful?