Contacts
Contacts
Contacts and conversation infrastructure
Contacts API
Protected core TRI routesContacts routes reuse the existing TRI application service layer and keep private key material out of the API boundary.
| GET | /api/tri/contacts | Fetch contacts available to the authenticated TRI service context |
| POST | /api/tri/contacts/upsert | Create or update contact metadata |
| POST | /api/tri/read | Update read state |
| GET | /api/tri/conversation-profile | Fetch conversation profile data |
| POST | /api/tri/conversation-settings | Update conversation settings |
| POST | /api/tri/conversation-state | Update conversation state |
cURL
curl -H "Authorization: Bearer $TRI_API_SERVICE_TOKEN" \
https://api.tri1space.com/api/tri/contacts
JavaScript fetch
const response = await fetch('https://api.tri1space.com/api/tri/contacts', {
headers: {
'X-TRI-API-Key': process.env.TRI_API_SERVICE_TOKEN
}
});
const contacts = await response.json();
Upsert contact
curl -X POST https://api.tri1space.com/api/tri/contacts/upsert \
-H "Authorization: Bearer $TRI_API_SERVICE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ownerTriId": "tri1qowner",
"contactTriId": "tri1qcontact",
"displayName": "Public Contact",
"trusted": true
}'
await fetch('https://api.tri1space.com/api/tri/contacts/upsert', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.TRI_API_SERVICE_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
ownerTriId: 'tri1qowner',
contactTriId: 'tri1qcontact',
displayName: 'Public Contact',
trusted: true
})
});