Skip to content

Instantly share code, notes, and snippets.

@dbhurley
Last active February 14, 2025 17:45
Show Gist options
  • Save dbhurley/ce2542f9a285434672877b4eef73bdb7 to your computer and use it in GitHub Desktop.
Save dbhurley/ce2542f9a285434672877b4eef73bdb7 to your computer and use it in GitHub Desktop.
openai.json
{
"openapi": "3.0.0",
"info": {
"title": "Monica CRM API",
"version": "1.0.2",
"description": "Comprehensive Monica CRM API endpoints for contacts, notes, activities, tasks, reminders, conversations (and messages), calls, journal entries, tags and contact fields. All endpoints require OAuth2 authentication."
},
"servers": [
{
"url": "https://brain.lovemolly.app/api",
"description": "Production server"
}
],
"paths": {
"/contacts": {
"get": {
"summary": "List contacts",
"description": "Retrieve a paginated list of contacts. Optional query parameters allow for searching and filtering.",
"operationId": "listContacts",
"parameters": [
{
"name": "page",
"in": "query",
"description": "Page number for pagination",
"required": false,
"schema": {
"type": "integer",
"default": 1
}
},
{
"name": "limit",
"in": "query",
"description": "Number of contacts per page (max 100)",
"required": false,
"schema": {
"type": "integer",
"default": 10,
"maximum": 100
}
},
{
"name": "query",
"in": "query",
"description": "Search term to filter contacts by name, email, etc.",
"required": false,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "A list of contacts",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"contacts": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Contact"
}
},
"page": {
"type": "integer"
},
"limit": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
}
}
}
}
}
},
"post": {
"summary": "Create a contact",
"description": "Create a new contact.",
"operationId": "createContact",
"requestBody": {
"description": "Contact to add",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Contact"
}
}
}
},
"responses": {
"201": {
"description": "Contact created",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Contact"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/contacts/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the contact",
"required": true,
"schema": {
"type": "integer"
}
}
],
"get": {
"summary": "Retrieve a contact",
"description": "Get a single contact by its ID.",
"operationId": "getContact",
"responses": {
"200": {
"description": "Contact retrieved",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Contact"
}
}
}
},
"404": {
"description": "Contact not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"put": {
"summary": "Update a contact",
"description": "Update an existing contact by ID.",
"operationId": "updateContact",
"requestBody": {
"description": "Updated contact object",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Contact"
}
}
}
},
"responses": {
"200": {
"description": "Contact updated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Contact"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Contact not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"delete": {
"summary": "Delete a contact",
"description": "Delete a contact by its ID.",
"operationId": "deleteContact",
"responses": {
"204": {
"description": "Contact deleted"
},
"404": {
"description": "Contact not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/notes": {
"get": {
"summary": "List notes",
"description": "Retrieve a list of notes. Optional query parameters allow filtering (e.g., by contact_id).",
"operationId": "listNotes",
"parameters": [
{
"name": "contact_id",
"in": "query",
"description": "Filter notes by contact ID",
"required": false,
"schema": {
"type": "integer"
}
},
{
"name": "page",
"in": "query",
"description": "Page number",
"required": false,
"schema": {
"type": "integer",
"default": 1
}
},
{
"name": "limit",
"in": "query",
"description": "Items per page",
"required": false,
"schema": {
"type": "integer",
"default": 10,
"maximum": 100
}
}
],
"responses": {
"200": {
"description": "A list of notes",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"notes": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Note"
}
},
"page": { "type": "integer" },
"limit": { "type": "integer" },
"total": { "type": "integer" }
}
}
}
}
}
}
},
"post": {
"summary": "Create a note",
"description": "Create a new note. The note must include the body, contact_id, and is_favorited flag.",
"operationId": "createNote",
"requestBody": {
"description": "Note object. Required fields: body (max 100000 characters), contact_id, is_favorited (0 or 1). The contact should be looked up when necessary.",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Note"
},
"example": {
"body": "This is a sample of a note.",
"contact_id": 1,
"is_favorited": 0
}
}
}
},
"responses": {
"201": {
"description": "Note created",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Note"
}
}
}
},
"400": {
"description": "Invalid note data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/notes/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the note",
"required": true,
"schema": {
"type": "integer"
}
}
],
"get": {
"summary": "Retrieve a note",
"description": "Get a note by its ID.",
"operationId": "getNote",
"responses": {
"200": {
"description": "Note retrieved",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Note"
}
}
}
},
"404": {
"description": "Note not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"put": {
"summary": "Update a note",
"description": "Update an existing note by its ID.",
"operationId": "updateNote",
"requestBody": {
"description": "Updated note object",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Note"
}
}
}
},
"responses": {
"200": {
"description": "Note updated",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Note"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Note not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"delete": {
"summary": "Delete a note",
"description": "Delete a note by its ID.",
"operationId": "deleteNote",
"responses": {
"204": {
"description": "Note deleted"
},
"404": {
"description": "Note not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/activities": {
"get": {
"summary": "List activities",
"description": "Retrieve a list of activities with optional pagination and filtering by contact_id.",
"operationId": "listActivities",
"parameters": [
{
"name": "contact_id",
"in": "query",
"description": "Filter activities by contact ID",
"required": false,
"schema": {
"type": "integer"
}
},
{
"name": "page",
"in": "query",
"description": "Page number",
"required": false,
"schema": {
"type": "integer",
"default": 1
}
},
{
"name": "limit",
"in": "query",
"description": "Items per page",
"required": false,
"schema": {
"type": "integer",
"default": 10,
"maximum": 100
}
}
],
"responses": {
"200": {
"description": "List of activities",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"activities": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Activity"
}
},
"page": { "type": "integer" },
"limit": { "type": "integer" },
"total": { "type": "integer" }
}
}
}
}
}
}
},
"post": {
"summary": "Create an activity",
"description": "Create a new activity. Required fields: contact_id, type, description and date.",
"operationId": "createActivity",
"requestBody": {
"description": "Activity object",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Activity"
}
}
}
},
"responses": {
"201": {
"description": "Activity created",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Activity"
}
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/activities/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the activity",
"required": true,
"schema": {
"type": "integer"
}
}
],
"get": {
"summary": "Retrieve an activity",
"description": "Get an activity by its ID.",
"operationId": "getActivity",
"responses": {
"200": {
"description": "Activity retrieved",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Activity" }
}
}
},
"404": {
"description": "Activity not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"put": {
"summary": "Update an activity",
"description": "Update an existing activity by its ID.",
"operationId": "updateActivity",
"requestBody": {
"description": "Updated activity object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Activity" }
}
}
},
"responses": {
"200": {
"description": "Activity updated",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Activity" }
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"404": {
"description": "Activity not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"delete": {
"summary": "Delete an activity",
"description": "Delete an activity by its ID.",
"operationId": "deleteActivity",
"responses": {
"204": { "description": "Activity deleted" },
"404": {
"description": "Activity not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/tasks": {
"get": {
"summary": "List tasks",
"description": "Retrieve a list of tasks. Optional query parameters for pagination and filtering by contact_id.",
"operationId": "listTasks",
"parameters": [
{
"name": "contact_id",
"in": "query",
"description": "Filter tasks by contact ID",
"required": false,
"schema": { "type": "integer" }
},
{
"name": "page",
"in": "query",
"description": "Page number",
"required": false,
"schema": { "type": "integer", "default": 1 }
},
{
"name": "limit",
"in": "query",
"description": "Tasks per page",
"required": false,
"schema": { "type": "integer", "default": 10, "maximum": 100 }
}
],
"responses": {
"200": {
"description": "List of tasks",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"tasks": {
"type": "array",
"items": { "$ref": "#/components/schemas/Task" }
},
"page": { "type": "integer" },
"limit": { "type": "integer" },
"total": { "type": "integer" }
}
}
}
}
}
}
},
"post": {
"summary": "Create a task",
"description": "Create a new task. Required fields: contact_id, title, and completed (0 or 1).",
"operationId": "createTask",
"requestBody": {
"description": "Task object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Task" },
"example": {
"contact_id": 1,
"title": "Bring back the table",
"description": "I borrowed a table a while ago.",
"completed": 0
}
}
}
},
"responses": {
"201": {
"description": "Task created",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Task" }
}
}
},
"400": {
"description": "Invalid task data",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/tasks/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the task",
"required": true,
"schema": { "type": "integer" }
}
],
"get": {
"summary": "Retrieve a task",
"description": "Get a task by its ID.",
"operationId": "getTask",
"responses": {
"200": {
"description": "Task retrieved",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Task" }
}
}
},
"404": {
"description": "Task not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"put": {
"summary": "Update a task",
"description": "Update an existing task by its ID.",
"operationId": "updateTask",
"requestBody": {
"description": "Updated task object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Task" }
}
}
},
"responses": {
"200": {
"description": "Task updated",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Task" }
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"404": {
"description": "Task not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"delete": {
"summary": "Delete a task",
"description": "Delete a task by its ID.",
"operationId": "deleteTask",
"responses": {
"204": { "description": "Task deleted" },
"404": {
"description": "Task not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/reminders": {
"get": {
"summary": "List reminders",
"description": "Retrieve a list of reminders with optional filtering by contact_id.",
"operationId": "listReminders",
"parameters": [
{
"name": "contact_id",
"in": "query",
"description": "Filter reminders by contact ID",
"required": false,
"schema": { "type": "integer" }
},
{
"name": "page",
"in": "query",
"description": "Page number",
"required": false,
"schema": { "type": "integer", "default": 1 }
},
{
"name": "limit",
"in": "query",
"description": "Reminders per page",
"required": false,
"schema": { "type": "integer", "default": 10, "maximum": 100 }
}
],
"responses": {
"200": {
"description": "List of reminders",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"reminders": {
"type": "array",
"items": { "$ref": "#/components/schemas/Reminder" }
},
"page": { "type": "integer" },
"limit": { "type": "integer" },
"total": { "type": "integer" }
}
}
}
}
}
}
},
"post": {
"summary": "Create a reminder",
"description": "Create a new reminder. Required fields: contact_id, title, and reminder_date.",
"operationId": "createReminder",
"requestBody": {
"description": "Reminder object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Reminder" }
}
}
},
"responses": {
"201": {
"description": "Reminder created",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Reminder" }
}
}
},
"400": {
"description": "Invalid reminder data",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/reminders/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the reminder",
"required": true,
"schema": { "type": "integer" }
}
],
"get": {
"summary": "Retrieve a reminder",
"description": "Get a reminder by its ID.",
"operationId": "getReminder",
"responses": {
"200": {
"description": "Reminder retrieved",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Reminder" }
}
}
},
"404": {
"description": "Reminder not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"put": {
"summary": "Update a reminder",
"description": "Update an existing reminder by its ID.",
"operationId": "updateReminder",
"requestBody": {
"description": "Updated reminder object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Reminder" }
}
}
},
"responses": {
"200": {
"description": "Reminder updated",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Reminder" }
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"404": {
"description": "Reminder not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"delete": {
"summary": "Delete a reminder",
"description": "Delete a reminder by its ID.",
"operationId": "deleteReminder",
"responses": {
"204": { "description": "Reminder deleted" },
"404": {
"description": "Reminder not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/conversations": {
"get": {
"summary": "List conversations",
"description": "Retrieve a list of conversations with optional filtering by contact_id.",
"operationId": "listConversations",
"parameters": [
{
"name": "contact_id",
"in": "query",
"description": "Filter conversations by contact ID",
"required": false,
"schema": { "type": "integer" }
},
{
"name": "page",
"in": "query",
"description": "Page number",
"required": false,
"schema": { "type": "integer", "default": 1 }
},
{
"name": "limit",
"in": "query",
"description": "Items per page",
"required": false,
"schema": { "type": "integer", "default": 10, "maximum": 100 }
}
],
"responses": {
"200": {
"description": "List of conversations",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"conversations": {
"type": "array",
"items": { "$ref": "#/components/schemas/Conversation" }
},
"page": { "type": "integer" },
"limit": { "type": "integer" },
"total": { "type": "integer" }
}
}
}
}
}
}
},
"post": {
"summary": "Create a conversation",
"description": "Start a new conversation. Required fields: contact_id, subject, and status.",
"operationId": "createConversation",
"requestBody": {
"description": "Conversation object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Conversation" }
}
}
},
"responses": {
"201": {
"description": "Conversation created",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Conversation" }
}
}
},
"400": {
"description": "Invalid conversation data",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/conversations/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the conversation",
"required": true,
"schema": { "type": "integer" }
}
],
"get": {
"summary": "Retrieve a conversation",
"description": "Get a conversation by its ID.",
"operationId": "getConversation",
"responses": {
"200": {
"description": "Conversation retrieved",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Conversation" }
}
}
},
"404": {
"description": "Conversation not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"put": {
"summary": "Update a conversation",
"description": "Update an existing conversation by its ID.",
"operationId": "updateConversation",
"requestBody": {
"description": "Updated conversation object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Conversation" }
}
}
},
"responses": {
"200": {
"description": "Conversation updated",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Conversation" }
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"404": {
"description": "Conversation not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"delete": {
"summary": "Delete a conversation",
"description": "Delete a conversation by its ID.",
"operationId": "deleteConversation",
"responses": {
"204": { "description": "Conversation deleted" },
"404": {
"description": "Conversation not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/conversations/{id}/messages": {
"post": {
"summary": "Add a message to a conversation",
"description": "Append a new message to an existing conversation. Required fields: conversation_id, sender, and message.",
"operationId": "addConversationMessage",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the conversation",
"required": true,
"schema": { "type": "integer" }
}
],
"requestBody": {
"description": "Message object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ConversationMessage" }
}
}
},
"responses": {
"201": {
"description": "Message added",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ConversationMessage" }
}
}
},
"400": {
"description": "Invalid message data",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/calls": {
"get": {
"summary": "List calls",
"description": "Retrieve a list of calls with optional filtering by contact_id.",
"operationId": "listCalls",
"parameters": [
{
"name": "contact_id",
"in": "query",
"description": "Filter calls by contact ID",
"required": false,
"schema": { "type": "integer" }
},
{
"name": "page",
"in": "query",
"description": "Page number",
"required": false,
"schema": { "type": "integer", "default": 1 }
},
{
"name": "limit",
"in": "query",
"description": "Calls per page",
"required": false,
"schema": { "type": "integer", "default": 10, "maximum": 100 }
}
],
"responses": {
"200": {
"description": "List of calls",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"calls": {
"type": "array",
"items": { "$ref": "#/components/schemas/Call" }
},
"page": { "type": "integer" },
"limit": { "type": "integer" },
"total": { "type": "integer" }
}
}
}
}
}
}
},
"post": {
"summary": "Create a call",
"description": "Log a new call. Required fields: contact_id, duration, and call_date.",
"operationId": "createCall",
"requestBody": {
"description": "Call object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Call" }
}
}
},
"responses": {
"201": {
"description": "Call created",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Call" }
}
}
},
"400": {
"description": "Invalid call data",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/calls/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the call",
"required": true,
"schema": { "type": "integer" }
}
],
"get": {
"summary": "Retrieve a call",
"description": "Get a call by its ID.",
"operationId": "getCall",
"responses": {
"200": {
"description": "Call retrieved",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Call" }
}
}
},
"404": {
"description": "Call not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"put": {
"summary": "Update a call",
"description": "Update an existing call by its ID.",
"operationId": "updateCall",
"requestBody": {
"description": "Updated call object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Call" }
}
}
},
"responses": {
"200": {
"description": "Call updated",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Call" }
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"404": {
"description": "Call not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"delete": {
"summary": "Delete a call",
"description": "Delete a call by its ID.",
"operationId": "deleteCall",
"responses": {
"204": { "description": "Call deleted" },
"404": {
"description": "Call not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/journal": {
"get": {
"summary": "List journal entries",
"description": "Retrieve a list of journal entries with optional filtering by contact_id.",
"operationId": "listJournalEntries",
"parameters": [
{
"name": "contact_id",
"in": "query",
"description": "Filter journal entries by contact ID",
"required": false,
"schema": { "type": "integer" }
},
{
"name": "page",
"in": "query",
"description": "Page number",
"required": false,
"schema": { "type": "integer", "default": 1 }
},
{
"name": "limit",
"in": "query",
"description": "Items per page",
"required": false,
"schema": { "type": "integer", "default": 10, "maximum": 100 }
}
],
"responses": {
"200": {
"description": "List of journal entries",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"journal_entries": {
"type": "array",
"items": { "$ref": "#/components/schemas/JournalEntry" }
},
"page": { "type": "integer" },
"limit": { "type": "integer" },
"total": { "type": "integer" }
}
}
}
}
}
}
},
"post": {
"summary": "Create a journal entry",
"description": "Create a new journal entry. Required fields: contact_id, entry, and date.",
"operationId": "createJournalEntry",
"requestBody": {
"description": "Journal entry object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/JournalEntry" }
}
}
},
"responses": {
"201": {
"description": "Journal entry created",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/JournalEntry" }
}
}
},
"400": {
"description": "Invalid journal entry data",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/journal/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the journal entry",
"required": true,
"schema": { "type": "integer" }
}
],
"get": {
"summary": "Retrieve a journal entry",
"description": "Get a journal entry by its ID.",
"operationId": "getJournalEntry",
"responses": {
"200": {
"description": "Journal entry retrieved",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/JournalEntry" }
}
}
},
"404": {
"description": "Journal entry not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"put": {
"summary": "Update a journal entry",
"description": "Update an existing journal entry by its ID.",
"operationId": "updateJournalEntry",
"requestBody": {
"description": "Updated journal entry object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/JournalEntry" }
}
}
},
"responses": {
"200": {
"description": "Journal entry updated",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/JournalEntry" }
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"404": {
"description": "Journal entry not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"delete": {
"summary": "Delete a journal entry",
"description": "Delete a journal entry by its ID.",
"operationId": "deleteJournalEntry",
"responses": {
"204": { "description": "Journal entry deleted" },
"404": {
"description": "Journal entry not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/tags": {
"get": {
"summary": "List tags",
"description": "Retrieve a list of tags.",
"operationId": "listTags",
"parameters": [
{
"name": "page",
"in": "query",
"description": "Page number",
"required": false,
"schema": { "type": "integer", "default": 1 }
},
{
"name": "limit",
"in": "query",
"description": "Tags per page",
"required": false,
"schema": { "type": "integer", "default": 10, "maximum": 100 }
}
],
"responses": {
"200": {
"description": "List of tags",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"tags": {
"type": "array",
"items": { "$ref": "#/components/schemas/Tag" }
},
"page": { "type": "integer" },
"limit": { "type": "integer" },
"total": { "type": "integer" }
}
}
}
}
}
}
},
"post": {
"summary": "Create a tag",
"description": "Create a new tag. Required field: name.",
"operationId": "createTag",
"requestBody": {
"description": "Tag object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Tag" }
}
}
},
"responses": {
"201": {
"description": "Tag created",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Tag" }
}
}
},
"400": {
"description": "Invalid tag data",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/tags/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the tag",
"required": true,
"schema": { "type": "integer" }
}
],
"get": {
"summary": "Retrieve a tag",
"description": "Get a tag by its ID.",
"operationId": "getTag",
"responses": {
"200": {
"description": "Tag retrieved",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Tag" }
}
}
},
"404": {
"description": "Tag not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"put": {
"summary": "Update a tag",
"description": "Update an existing tag by its ID.",
"operationId": "updateTag",
"requestBody": {
"description": "Updated tag object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Tag" }
}
}
},
"responses": {
"200": {
"description": "Tag updated",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Tag" }
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"404": {
"description": "Tag not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"delete": {
"summary": "Delete a tag",
"description": "Delete a tag by its ID.",
"operationId": "deleteTag",
"responses": {
"204": { "description": "Tag deleted" },
"404": {
"description": "Tag not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/contact-fields": {
"get": {
"summary": "List contact fields",
"description": "Retrieve a list of custom contact fields.",
"operationId": "listContactFields",
"responses": {
"200": {
"description": "List of contact fields",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": { "$ref": "#/components/schemas/ContactField" }
}
}
}
}
}
},
"post": {
"summary": "Create a contact field",
"description": "Create a new custom contact field. Required fields: name and value.",
"operationId": "createContactField",
"requestBody": {
"description": "Contact field object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ContactField" }
}
}
},
"responses": {
"201": {
"description": "Contact field created",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ContactField" }
}
}
},
"400": {
"description": "Invalid data",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
},
"/contact-fields/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of the contact field",
"required": true,
"schema": { "type": "integer" }
}
],
"get": {
"summary": "Retrieve a contact field",
"description": "Get a custom contact field by its ID.",
"operationId": "getContactField",
"responses": {
"200": {
"description": "Contact field retrieved",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ContactField" }
}
}
},
"404": {
"description": "Contact field not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"put": {
"summary": "Update a contact field",
"description": "Update an existing custom contact field by its ID.",
"operationId": "updateContactField",
"requestBody": {
"description": "Updated contact field object",
"required": true,
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ContactField" }
}
}
},
"responses": {
"200": {
"description": "Contact field updated",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/ContactField" }
}
}
},
"400": {
"description": "Invalid input",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
},
"404": {
"description": "Contact field not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
},
"delete": {
"summary": "Delete a contact field",
"description": "Delete a custom contact field by its ID.",
"operationId": "deleteContactField",
"responses": {
"204": { "description": "Contact field deleted" },
"404": {
"description": "Contact field not found",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/Error" }
}
}
}
}
}
}
},
"components": {
"schemas": {
"Contact": {
"type": "object",
"properties": {
"id": { "type": "integer", "readOnly": true },
"first_name": { "type": "string" },
"last_name": { "type": "string" },
"email": { "type": "string", "format": "email" },
"phone": { "type": "string" },
"address": { "type": "string" },
"created_at": { "type": "string", "format": "date-time", "readOnly": true },
"updated_at": { "type": "string", "format": "date-time", "readOnly": true }
},
"required": ["first_name", "last_name", "email"]
},
"Note": {
"type": "object",
"properties": {
"id": { "type": "integer", "readOnly": true },
"body": { "type": "string", "maxLength": 100000 },
"contact_id": { "type": "integer" },
"is_favorited": { "type": "integer", "enum": [0, 1] },
"created_at": { "type": "string", "format": "date-time", "readOnly": true },
"updated_at": { "type": "string", "format": "date-time", "readOnly": true }
},
"required": ["body", "contact_id", "is_favorited"]
},
"Activity": {
"type": "object",
"properties": {
"id": { "type": "integer", "readOnly": true },
"contact_id": { "type": "integer" },
"type": { "type": "string", "description": "Type of activity (e.g. call, meeting, email)" },
"description": { "type": "string" },
"date": { "type": "string", "format": "date-time" },
"created_at": { "type": "string", "format": "date-time", "readOnly": true },
"updated_at": { "type": "string", "format": "date-time", "readOnly": true }
},
"required": ["contact_id", "type", "description", "date"]
},
"Task": {
"type": "object",
"properties": {
"id": { "type": "integer", "readOnly": true },
"contact_id": { "type": "integer" },
"title": { "type": "string", "maxLength": 255 },
"description": { "type": "string" },
"completed": { "type": "integer", "enum": [0, 1] },
"completed_at": { "type": "string", "format": "date-time" },
"created_at": { "type": "string", "format": "date-time", "readOnly": true },
"updated_at": { "type": "string", "format": "date-time", "readOnly": true }
},
"required": ["contact_id", "title", "completed"]
},
"Reminder": {
"type": "object",
"properties": {
"id": { "type": "integer", "readOnly": true },
"contact_id": { "type": "integer" },
"title": { "type": "string" },
"reminder_date": { "type": "string", "format": "date-time" },
"completed": { "type": "boolean", "default": false },
"created_at": { "type": "string", "format": "date-time", "readOnly": true },
"updated_at": { "type": "string", "format": "date-time", "readOnly": true }
},
"required": ["contact_id", "title", "reminder_date"]
},
"Conversation": {
"type": "object",
"properties": {
"id": { "type": "integer", "readOnly": true },
"contact_id": { "type": "integer" },
"subject": { "type": "string" },
"status": { "type": "string", "description": "Status of the conversation (e.g. open, closed)" },
"created_at": { "type": "string", "format": "date-time", "readOnly": true },
"updated_at": { "type": "string", "format": "date-time", "readOnly": true }
},
"required": ["contact_id", "subject", "status"]
},
"ConversationMessage": {
"type": "object",
"properties": {
"id": { "type": "integer", "readOnly": true },
"conversation_id": { "type": "integer" },
"sender": { "type": "string" },
"message": { "type": "string" },
"created_at": { "type": "string", "format": "date-time", "readOnly": true },
"updated_at": { "type": "string", "format": "date-time", "readOnly": true }
},
"required": ["conversation_id", "sender", "message"]
},
"Call": {
"type": "object",
"properties": {
"id": { "type": "integer", "readOnly": true },
"contact_id": { "type": "integer" },
"duration": { "type": "integer", "description": "Duration of the call in seconds" },
"notes": { "type": "string" },
"call_date": { "type": "string", "format": "date-time" },
"created_at": { "type": "string", "format": "date-time", "readOnly": true },
"updated_at": { "type": "string", "format": "date-time", "readOnly": true }
},
"required": ["contact_id", "duration", "call_date"]
},
"JournalEntry": {
"type": "object",
"properties": {
"id": { "type": "integer", "readOnly": true },
"contact_id": { "type": "integer" },
"entry": { "type": "string" },
"date": { "type": "string", "format": "date-time" },
"created_at": { "type": "string", "format": "date-time", "readOnly": true },
"updated_at": { "type": "string", "format": "date-time", "readOnly": true }
},
"required": ["contact_id", "entry", "date"]
},
"Tag": {
"type": "object",
"properties": {
"id": { "type": "integer", "readOnly": true },
"name": { "type": "string" },
"color": { "type": "string", "description": "Optional color code for the tag" },
"created_at": { "type": "string", "format": "date-time", "readOnly": true }
},
"required": ["name"]
},
"ContactField": {
"type": "object",
"properties": {
"id": { "type": "integer", "readOnly": true },
"name": { "type": "string" },
"value": { "type": "string" },
"created_at": { "type": "string", "format": "date-time", "readOnly": true },
"updated_at": { "type": "string", "format": "date-time", "readOnly": true }
},
"required": ["name", "value"]
},
"Error": {
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"message": { "type": "string" },
"error_code": { "type": "integer" }
}
}
}
}
},
"securitySchemes": {
"OAuth2": {
"type": "oauth2",
"flows": {
"clientCredentials": {
"tokenUrl": "https://brain.lovemolly.app/oauth/token",
"scopes": {}
}
}
}
}
},
"security": [
{
"OAuth2": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment