{"openapi":"3.0.0","info":{"title":"Dalil OAuth Resource API","version":"0.1.0","description":"API for OAuth clients to manage Dalil resources"},"paths":{"/leads":{"post":{"summary":"Create a new lead","description":"Create a new lead with the provided details. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":"string","description":"The first name of the lead","example":"John"},"lastName":{"type":"string","description":"The last name of the lead","example":"Doe"},"email":{"type":"string","format":"email","description":"Email address of the lead","example":"johndoe@example.com"},"phone":{"type":"string","description":"Phone number of the lead","example":"123-456-7890"},"company":{"type":"string","description":"Company name of the lead","example":"Tech Corp"},"title":{"type":"string","description":"Job title of the lead","example":"Software Engineer"},"location":{"type":"string","description":"Location of the lead","example":"San Francisco"},"description":{"type":"string","description":"Additional details about the lead","example":"Interested in our product"},"source":{"type":"string","description":"Source of the lead","example":"Web"},"groupId":{"type":"string"},"stageId":{"type":"string"},"priorityId":{"type":"string"},"labelIds":{"type":"array","items":{"type":"string"}}},"required":["firstName"]}}}},"responses":{"201":{"description":"Lead created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Lead created successfully!"},"leadId":{"type":"string","format":"uuid","example":"c056d1e3-62e8-4ec3-b733-7a7485fa48c8"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Unauthorized"}}}}}},"500":{"description":"Error occurred while creating the lead","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Error: Unable to create the lead."}}}}}}}}},"/leads/search":{"get":{"summary":"Search leads","description":"Search leads based on various parameters. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"parameters":[{"in":"query","name":"email","schema":{"type":"string"},"description":"Email address to search for (partial match)"},{"in":"query","name":"phone","schema":{"type":"string"},"description":"Phone number to search for (partial match)"},{"in":"query","name":"company","schema":{"type":"string"},"description":"Company name to search for (partial match)"},{"in":"query","name":"description","schema":{"type":"string"},"description":"Description to search for (partial match)"},{"in":"query","name":"first_name","schema":{"type":"string"},"description":"First name to search for (partial match)"},{"in":"query","name":"last_name","schema":{"type":"string"},"description":"Last name to search for (partial match)"},{"in":"query","name":"title","schema":{"type":"string"},"description":"Title to search for (partial match)"},{"in":"query","name":"groupId","schema":{"type":"string"},"description":"Group ID to filter by (required)"},{"in":"query","name":"stageId","schema":{"type":"string"},"description":"Stage ID to filter by (exact match)"},{"in":"query","name":"priorityId","schema":{"type":"string"},"description":"Priority ID to filter by (exact match)"}],"responses":{"200":{"description":"Successful search","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"group_id":{"type":"string"},"entity_base_id":{"type":"string"},"entity_type_id":{"type":"integer"},"phone_book_data":{"type":"object"}}}}}}},"400":{"description":"Bad request (missing parameters)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"404":{"description":"No matching leads found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}}}}},"/leads/search_by_and":{"get":{"summary":"Search leads by AND criteria","description":"Search leads based on exact match AND criteria across multiple fields. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"parameters":[{"in":"query","name":"email","schema":{"type":"string"},"description":"Email address to search for (exact match)"},{"in":"query","name":"phone","schema":{"type":"string"},"description":"Phone number to search for (exact match)"},{"in":"query","name":"company","schema":{"type":"string"},"description":"Company name to search for (exact match)"},{"in":"query","name":"description","schema":{"type":"string"},"description":"Description to search for (exact match)"},{"in":"query","name":"first_name","schema":{"type":"string"},"description":"First name to search for (exact match)"},{"in":"query","name":"last_name","schema":{"type":"string"},"description":"Last name to search for (exact match)"},{"in":"query","name":"title","schema":{"type":"string"},"description":"Title to search for (exact match)"}],"responses":{"200":{"description":"Successful search","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"group_id":{"type":"string"},"entity_base_id":{"type":"string"},"entity_type_id":{"type":"integer"},"phone_book_data":{"type":"object"}}}}}}},"400":{"description":"Bad request (missing parameters)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"404":{"description":"No matching leads found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}}}}},"/leads/update":{"put":{"summary":"Update a lead's phone book information","description":"Updates a lead's phone book information. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"entity_type_id":{"type":"integer","description":"The type ID of the entity."},"entity_base_id":{"type":"string","description":"The base ID of the entity."},"email":{"type":"string","description":"Email address to update."},"phone":{"type":"string","description":"Phone number to update."},"company":{"type":"string","description":"Company name to update."},"description":{"type":"string","description":"Description to update."},"first_name":{"type":"string","description":"First name to update."},"last_name":{"type":"string","description":"Last name to update."},"title":{"type":"string","description":"Title to update."}},"required":["entity_type_id","entity_base_id"]}}}},"responses":{"200":{"description":"Successful update","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"data":{"type":"object"}}}}}},"400":{"description":"Bad request (missing parameters or invalid request body)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}},"404":{"description":"Lead not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}}}}},"/leads/polling_trigger":{"get":{"summary":"Get all leads with phone book data","description":"Retrieves all leads with their associated phone book entries. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Successful retrieval","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"404":{"description":"No leads found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}}}}},"/contacts":{"post":{"summary":"Create a new contact","description":"Create a new contact with the provided details. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":"string","description":"The first name of the contact","example":"John"},"lastName":{"type":"string","description":"The last name of the contact","example":"Doe"},"accountId":{"type":"string","description":"The account Id of the contact","example":"Doe"},"email":{"type":"string","format":"email","description":"Email address of the contact","example":"johndoe@example.com"},"phone":{"type":"string","description":"Phone number of the contact","example":"123-456-7890"},"title":{"type":"string","description":"Job title of the contact","example":"Software Engineer"},"comments":{"type":"string","description":"Comment about the contact","example":"Tech Corp"},"groupId":{"type":"string"},"typeId":{"type":"string"},"priorityId":{"type":"string"},"dealIds":{"type":"array","items":{"type":"string"}}},"required":["firstName"]}}}},"responses":{"201":{"description":"Contact created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Contact created successfully!"},"contactId":{"type":"string","format":"uuid","example":"c056d1e3-62e8-4ec3-b733-7a7485fa48c8"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Unauthorized"}}}}}},"500":{"description":"Error occurred while creating the contact","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Error: Unable to create the contact."}}}}}}}}},"/contacts/search":{"get":{"summary":"Search contacts","description":"Search contacts based on various parameters. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"parameters":[{"in":"query","name":"email","schema":{"type":"string"},"description":"Email address to search for (partial match)"},{"in":"query","name":"phone","schema":{"type":"string"},"description":"Phone number to search for (partial match)"},{"in":"query","name":"description","schema":{"type":"string"},"description":"Description to search for (partial match)"},{"in":"query","name":"first_name","schema":{"type":"string"},"description":"First name to search for (partial match)"},{"in":"query","name":"last_name","schema":{"type":"string"},"description":"Last name to search for (partial match)"},{"in":"query","name":"title","schema":{"type":"string"},"description":"Title to search for (partial match)"},{"in":"query","name":"groupId","schema":{"type":"string"},"description":"Group ID to filter by (required)"},{"in":"query","name":"stageId","schema":{"type":"string"},"description":"Stage ID to filter by (exact match)"},{"in":"query","name":"priorityId","schema":{"type":"string"},"description":"Priority ID to filter by (exact match)"}],"responses":{"200":{"description":"Successful search","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"group_id":{"type":"string"},"entity_base_id":{"type":"string"},"entity_type_id":{"type":"integer"},"phone_book_data":{"type":"object"}}}}}}},"400":{"description":"Bad request (missing parameters)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"404":{"description":"No matching contacts found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}}}}},"/contacts/search_by_and":{"get":{"summary":"Search contacts by AND criteria","description":"Search contacts based on exact match AND criteria across multiple fields. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"parameters":[{"in":"query","name":"email","schema":{"type":"string"},"description":"Email address to search for (exact match)"},{"in":"query","name":"phone","schema":{"type":"string"},"description":"Phone number to search for (exact match)"},{"in":"query","name":"description","schema":{"type":"string"},"description":"Description to search for (exact match)"},{"in":"query","name":"first_name","schema":{"type":"string"},"description":"First name to search for (exact match)"},{"in":"query","name":"last_name","schema":{"type":"string"},"description":"Last name to search for (exact match)"},{"in":"query","name":"title","schema":{"type":"string"},"description":"Title to search for (exact match)"}],"responses":{"200":{"description":"Successful search","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"group_id":{"type":"string"},"entity_base_id":{"type":"string"},"entity_type_id":{"type":"integer"},"phone_book_data":{"type":"object"}}}}}}},"400":{"description":"Bad request (missing parameters)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"404":{"description":"No matching contacts found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}}}}},"/contacts/update":{"put":{"summary":"Update a contact's phone book information","description":"Updates a contact's phone book information. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"entity_type_id":{"type":"integer","description":"The type ID of the entity."},"entity_base_id":{"type":"string","description":"The base ID of the entity."},"email":{"type":"string","description":"Email address to update."},"phone":{"type":"string","description":"Phone number to update."},"description":{"type":"string","description":"Description to update."},"first_name":{"type":"string","description":"First name to update."},"last_name":{"type":"string","description":"Last name to update."},"title":{"type":"string","description":"Title to update."}},"required":["entity_type_id","entity_base_id"]}}}},"responses":{"200":{"description":"Successful update","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"data":{"type":"object"}}}}}},"400":{"description":"Bad request (missing parameters or invalid request body)","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}},"404":{"description":"Contact not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}}}}},"/contacts/polling_trigger":{"get":{"summary":"Get all contacts with phone book data","description":"Retrieves all contacts with their associated phone book entries. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Successful retrieval","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"404":{"description":"No contacts found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"error":{"type":"object"}}}}}}}}},"/accounts":{"post":{"summary":"Create a new account","description":"Create a new contact with the provided details. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"companyName":{"type":"string"},"website":{"type":"string"},"industry":{"type":"string"},"noOfEmployees":{"type":"number"},"description":{"type":"string"},"headquarters":{"type":"string"},"groupId":{"type":"string"},"typeId":{"type":"string"},"priorityId":{"type":"string"},"labelIds":{"type":"array","items":{"type":"string"}},"dealIds":{"type":"array","items":{"type":"string"}}},"required":["companyName"]}}}},"responses":{"201":{"description":"Account created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Account created successfully!"},"accountId":{"type":"string","format":"uuid","example":"c056d1e3-62e8-4ec3-b733-7a7485fa48c8"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Unauthorized"}}}}}},"500":{"description":"Error occurred while creating the account","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Error: Unable to create the account."}}}}}}}}},"/accounts/search":{"get":{"summary":"Search for accounts","description":"Search and filter accounts based on various criteria including name, industry, headquarters, and more","operationId":"searchAccounts","parameters":[{"name":"account_name","in":"query","description":"Search accounts by name (matches against phone_book first_name)","required":false,"schema":{"type":"string"}},{"name":"account_industry","in":"query","description":"Filter accounts by industry (partial match)","required":false,"schema":{"type":"string"}},{"name":"account_hq","in":"query","description":"Filter accounts by headquarters location (partial match)","required":false,"schema":{"type":"string"}},{"name":"priority_id","in":"query","description":"Filter accounts by entity priority ID","required":false,"schema":{"type":"integer"}},{"name":"stage_id","in":"query","description":"Filter accounts by entity stage ID","required":false,"schema":{"type":"integer"}},{"name":"group_id","in":"query","description":"Filter accounts by group ID","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Successfully retrieved accounts","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"entity_type_id":{"type":"integer","description":"Type ID for the entity (fixed value: 2)","example":2},"id":{"type":"integer","description":"Unique identifier for the account"},"group_id":{"type":"integer","description":"Group identifier associated with the account","nullable":true},"type":{"type":"integer","description":"Entity stage ID","nullable":true},"priority":{"type":"integer","description":"Entity priority ID","nullable":true}}}}}}},"400":{"description":"Bad Request - Invalid parameters","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","examples":["User ID is required","Invalid priority_id format","Invalid stage_id format","Invalid group_id format"]}}}}}},"404":{"description":"No accounts found matching the criteria","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"No accounts found matching the criteria"}}}}}},"500":{"description":"Server error while fetching accounts","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Error fetching accounts"},"error":{"type":"object","description":"Error details from the database"}}}}}}},"security":[{"BearerAuth":[]}],"tags":["Accounts"]}},"/accounts/update":{"put":{"summary":"Update account information","description":"Update various fields of an account including name, domain, industry, and associated phone book details","operationId":"updateAccount","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["entity_type_id","entity_base_id"],"properties":{"entity_type_id":{"type":"integer","description":"Type identifier for the entity"},"entity_base_id":{"type":"integer","description":"Unique identifier of the account to update"},"account_name":{"type":"string","description":"New name for the account (updates phone_book.first_name)"},"domain":{"type":"string","description":"Company domain"},"industry":{"type":"string","description":"Industry sector of the company"},"comments":{"type":"string","description":"Additional comments about the account (updates phone_book.description)"},"no_of_employees":{"type":"integer","description":"Number of employees in the company"},"hq_location":{"type":"string","description":"Headquarters location"},"email":{"type":"string","format":"email","description":"Contact email address (updates phone_book.email)"}}}}}},"responses":{"200":{"description":"Account updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","enum":["Account updated successfully","No updates were made"]},"account":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"comments":{"type":"string"},"domain":{"type":"string"},"industry":{"type":"string"},"no_of_employees":{"type":"integer"},"headquarters":{"type":"string"},"last_updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad Request - Invalid or missing parameters","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","examples":["entity_type_id and entity_base_id are required","At least one update parameter is required"]}}}}}},"404":{"description":"Account not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Account not found"},"error":{"type":"object"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","examples":["Failed to update account name/comments","Failed to update account","Internal server error"]},"error":{"type":"object"}}}}}}},"security":[{"BearerAuth":[]}],"tags":["Accounts"]}},"/accounts/polling_trigger":{"get":{"summary":"Get all accounts with phone book details","description":"Retrieves all accounts ordered by creation date (newest first), including their associated phone book information","operationId":"getAllAccounts","responses":{"200":{"description":"Successfully retrieved accounts","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier for the account"},"domain":{"type":"string","description":"Company domain"},"industry":{"type":"string","description":"Industry sector"},"headquarters":{"type":"string","description":"Company headquarters location"},"no_of_employees":{"type":"integer","description":"Number of employees"},"created_at":{"type":"string","format":"date-time","description":"Account creation timestamp"},"last_updated_at":{"type":"string","format":"date-time","description":"Last update timestamp"},"phone_book":{"type":"object","description":"Associated phone book details","properties":{"id":{"type":"integer","description":"Phone book entry ID"},"first_name":{"type":"string","description":"Account name"},"email":{"type":"string","format":"email","description":"Contact email address"},"description":{"type":"string","description":"Additional comments or description"}}}}}}}}},"404":{"description":"No accounts found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"No accounts found"}}}}}}},"security":[{"BearerAuth":[]}],"tags":["Accounts"]}},"/deals/search":{"get":{"summary":"Search for deals","description":"Search and filter deals based on various criteria including name, priority, stage, and more","operationId":"searchDeals","parameters":[{"name":"priority_id","in":"query","description":"Filter deals by entity priority ID","required":false,"schema":{"type":"integer"}},{"name":"stage_id","in":"query","description":"Filter deals by entity stage ID","required":false,"schema":{"type":"integer"}},{"name":"group_id","in":"query","description":"Filter deals by group ID","required":false,"schema":{"type":"integer"}},{"name":"commit_status","in":"query","description":"Filter deals by commitment status","required":false,"schema":{"type":"string","enum":["Committed","Not Committed"]}},{"name":"deal_name","in":"query","description":"Search deals by name (partial match)","required":false,"schema":{"type":"string"}},{"name":"account_name","in":"query","description":"Search deals by associated account name","required":false,"schema":{"type":"string"}},{"name":"owner","in":"query","description":"Filter deals by owner name (partial match)","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully retrieved deals (empty array if no matches found)","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"entity_type_id":{"type":"integer","description":"Type ID for deals (fixed value: 3)","example":3},"id":{"type":"integer","description":"Unique identifier for the deal"},"name":{"type":"string","description":"Deal name"},"revenue":{"type":"number","description":"Deal value/revenue"},"currency":{"type":"string","description":"Deal currency"},"close_date":{"type":"string","format":"date-time","description":"Expected close date"},"type":{"type":"integer","description":"Entity stage ID"},"priority":{"type":"integer","description":"Entity priority ID"},"group_id":{"type":"integer","description":"Group identifier"},"stage":{"type":"integer","description":"Entity stage ID"},"owner":{"type":"string","description":"Name of the deal owner"},"is_committed":{"type":"boolean","description":"Deal commitment status"}}}}}}}},"security":[{"BearerAuth":[]}],"tags":["Deals"]}},"/deals/update":{"put":{"summary":"Update deal information","description":"Update various fields of a deal including name, value, commitment status, and close date","operationId":"updateDeal","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["entity_type_id","entity_base_id"],"properties":{"entity_type_id":{"type":"integer","description":"Type identifier for the entity"},"entity_base_id":{"type":"integer","description":"Unique identifier of the deal to update"},"deal_name":{"type":"string","description":"New name for the deal"},"deal_value":{"type":"number","description":"New value/revenue for the deal"},"commit_status":{"type":"string","enum":["Committed","Not Committed"],"description":"New commitment status for the deal"},"close_date":{"type":"string","format":"date-time","description":"New expected close date"}}}}}},"responses":{"200":{"description":"Deal updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Deal updated successfully"},"deal":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"revenue":{"type":"number"},"is_committed":{"type":"boolean"},"close_date":{"type":"string","format":"date-time"},"last_updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad Request - Invalid or missing parameters","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","examples":["entity_type_id and entity_base_id are required","At least one update parameter is required"]}}}}}},"404":{"description":"Deal not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Deal not found"},"error":{"type":"object"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","examples":["Failed to update deal","Internal server error"]},"error":{"type":"object"}}}}}}},"security":[{"BearerAuth":[]}],"tags":["Deals"]}},"/deals/polling_trigger":{"get":{"summary":"Get all deals","description":"Retrieves all deals ordered by creation date (newest first)","operationId":"getAllDeals","responses":{"200":{"description":"Successfully retrieved deals","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier for the deal"},"name":{"type":"string","description":"Deal name"},"revenue":{"type":"number","description":"Deal value/revenue"},"currency":{"type":"string","description":"Deal currency"},"close_date":{"type":"string","format":"date-time","description":"Expected close date"},"entity_stage_id":{"type":"integer","description":"Stage identifier"},"entity_priority_id":{"type":"integer","description":"Priority identifier"},"is_committed":{"type":"boolean","description":"Deal commitment status"},"created_at":{"type":"string","format":"date-time","description":"Deal creation timestamp"},"last_updated_at":{"type":"string","format":"date-time","description":"Last update timestamp"}}}}}}},"404":{"description":"No deals found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"No deals found"}}}}}}},"security":[{"BearerAuth":[]}],"tags":["Deals"]}},"/deals":{"post":{"summary":"Create a new deal","description":"Create a new contact with the provided details. Requires a valid Bearer token.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"expectedDealValue":{"type":"number"},"currency":{"type":"string"},"closeDate":{"type":"string"},"groupId":{"type":"string"},"stageId":{"type":"string"},"priorityId":{"type":"string"},"labelIds":{"type":"array","items":{"type":"string"}},"source":{"type":"string"},"contactIds":{"type":"array","items":{"type":"string"}},"accountIds":{"type":"array","items":{"type":"string"}}},"required":["name"]}}}},"responses":{"201":{"description":"Account created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Account created successfully!"},"accountId":{"type":"string","format":"uuid","example":"c056d1e3-62e8-4ec3-b733-7a7485fa48c8"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Unauthorized"}}}}}},"500":{"description":"Error occurred while creating the account","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Error: Unable to create the account."}}}}}}}}},"/email-receive-webhook":{"post":{"summary":"Process email updates and deletions","description":"This endpoint processes email updates and deletions based on the provided payload.","operationId":"processEmail","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"triggerType":{"type":"string","example":"updated"},"userId":{"type":"string","example":"user-123"},"connectionType":{"type":"string","example":"gmail"},"connectionId":{"type":"string","example":"conn-123"},"data":{"type":"object","properties":{"fields":{"type":"object","properties":{"id":{"type":"string","example":"msg-123"},"threadId":{"type":"string","example":"thread-123"},"from":{"type":"object","properties":{"emailAddress":{"type":"object","properties":{"address":{"type":"string","example":"sender@example.com"}}}}},"to":{"type":"array","items":{"type":"object","properties":{"emailAddress":{"type":"object","properties":{"address":{"type":"string","example":"recipient@example.com"}}}}}},"cc":{"type":"array","items":{"type":"object","properties":{"emailAddress":{"type":"object","properties":{"address":{"type":"string","example":"cc@example.com"}}}}}},"bcc":{"type":"array","items":{"type":"object","properties":{"emailAddress":{"type":"object","properties":{"address":{"type":"string","example":"bcc@example.com"}}}}}},"subject":{"type":"string","example":"Email Subject"},"emailBody":{"type":"string","example":"Email body content"},"receivedDateTime":{"type":"string","format":"date-time","example":"2023-01-01T12:00:00Z"},"webLink":{"type":"string","example":"https://example.com/email"},"isRead":{"type":"boolean","example":true},"hasAttachments":{"type":"boolean","example":false}}},"rawFields":{"type":"object","properties":{"labelIds":{"type":"array","items":{"type":"string","example":"TRASH"}},"parentFolderId":{"type":"string","example":"folder-123"}}}}},"isBulkImport":{"type":"boolean","example":false}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Email processed successfully"}}}}}},"500":{"description":"Error occurred while processing the email","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Error: Unable to process the email."}}}}}}}}},"/email-bulk-process-webhook":{"post":{"summary":"Process email updates and deletions","description":"This endpoint processes email updates and deletions based on the provided payload.","operationId":"processEmail","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"connection_ids":{"type":"array","items":{"type":"string","example":"conn-123"}},"filterEmails":{"type":"array","items":{"type":"string","example":"example@example.com"}}}}}}}}},"responses":{"200":{"description":"Email processed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Email processed successfully"}}}}}},"500":{"description":"Error occurred while processing the email","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Error: Unable to process the email."}}}}}}}}},"/calendar-event-webhook":{"post":{"summary":"Process calendar event updates and deletions","description":"This endpoint processes calendar event updates and deletions based on the provided payload.","operationId":"processCalendarEvent","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"meetingId":{"type":"string","example":"meeting-123"},"connectionId":{"type":"string","example":"conn-123"},"userId":{"type":"string","example":"user-123"},"calendarType":{"type":"string","example":"google-calendar"},"type":{"type":"string","example":"created"},"calendarId":{"type":"string","example":"calendar-123"},"data":{"type":"object","properties":{"fields":{"type":"object","properties":{"id":{"type":"string","example":"event-123"},"allDay":{"type":"boolean","example":false},"attendees":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string","example":"attendee@example.com"}}}},"createdTime":{"type":"string","format":"date-time","example":"2023-01-01T12:00:00Z"},"description":{"type":"string","example":"Event description"},"endDate":{"type":"string","format":"date-time","example":"2023-01-01T13:00:00Z"},"fromDate":{"type":"string","format":"date-time","example":"2023-01-01T12:00:00Z"},"location":{"type":"string","example":"Event location"},"subject":{"type":"string","example":"Event subject"},"timezone":{"type":"string","example":"UTC"},"webLink":{"type":"string","example":"https://example.com/event"},"recurrence":{"type":"string","example":"RRULE:FREQ=DAILY;COUNT=5"},"meetingLink":{"type":"string","example":"https://example.com/meeting"},"organizer":{"type":"string","example":"organizer@example.com"},"editable":{"type":"boolean","example":true},"isCancelled":{"type":"boolean","example":false}}}}}}}}}},"responses":{"200":{"description":"Event processed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Event processed successfully"}}}}}},"400":{"description":"Error occurred while processing the event","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Failed to process calendar event"}}}}}}}}},"/calendar-initial-sync":{"post":{"summary":"Process initial calendar sync","description":"This endpoint processes the initial calendar sync based on the provided payload.","operationId":"processCalendarInitialSync","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"userId":{"type":"string","example":"user-123"},"connectionId":{"type":"string","example":"conn-123"},"tenantId":{"type":"number","example":1},"connectionType":{"type":"string","enum":["google-calendar","microsoft-outlook"],"example":"google-calendar"}}}}}}}},"responses":{"200":{"description":"Calendar sync is successful","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Calendar Sync is Successful"}}}}}},"400":{"description":"Error occurred while processing the calendar sync","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Failed to sync calendars"}}}}}}}}},"/cleanup-integration-app-customer":{"post":{"summary":"Clean up integration app customer data","description":"This endpoint cleans up all data related to an integration app customer based on the provided payload.","operationId":"cleanupCustomer","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"user_id":{"type":"string","example":"user-123"}}}}}},"responses":{"200":{"description":"Customer data cleaned up successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Int App customer cleaned up successfully!"},"id":{"type":"string","example":"user-123"}}}}}},"400":{"description":"Error occurred while cleaning up customer data","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to clean up customer data"}}}}}}}}},"/events":{"get":{"summary":"Get calendar events","description":"Retrieve calendar events based on the provided query parameters.","operationId":"getEvents","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","example":"user-123"}},{"name":"calendar_ids","in":"query","required":true,"schema":{"type":"string","example":"calendar-123,calendar-456"}},{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date-time","example":"2023-01-01T00:00:00Z"}},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date-time","example":"2023-01-31T23:59:59Z"}},{"name":"timezone","in":"query","required":true,"schema":{"type":"string","example":"UTC"}}],"responses":{"200":{"description":"Retrieved events successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Retrieved events successfully"},"length":{"type":"number","example":10},"data":{"type":"array","items":{"type":"object"}}}}}}},"400":{"description":"Error occurred while retrieving events","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Failed to get calendar events"}}}}}}}},"post":{"summary":"Create a calendar event","description":"Create a new calendar event based on the provided payload.","operationId":"createEvent","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tenantId":{"type":"number","example":1},"userId":{"type":"string","example":"user-123"},"connectionId":{"type":"string","example":"conn-123"},"calendarId":{"type":"string","example":"calendar-123"},"subject":{"type":"string","example":"Meeting with team"},"body":{"type":"object","properties":{"contentType":{"type":"string","example":"text/plain"},"content":{"type":"string","example":"Discuss project updates"}}},"start":{"type":"object","properties":{"dateTime":{"type":"string","format":"date-time","example":"2023-01-01T10:00:00Z"},"timeZone":{"type":"string","example":"UTC"}}},"end":{"type":"object","properties":{"dateTime":{"type":"string","format":"date-time","example":"2023-01-01T11:00:00Z"},"timeZone":{"type":"string","example":"UTC"}}},"userAttendees":{"type":"array","items":{"type":"string","example":"user@example.com"}},"leadAttendees":{"type":"array","items":{"type":"string","example":"lead@example.com"}},"contactAttendees":{"type":"array","items":{"type":"string","example":"contact@example.com"}},"otherAttendees":{"type":"array","items":{"type":"string","example":"other@example.com"}},"isOnlineMeeting":{"type":"boolean","example":true},"onlineMeetingProvider":{"type":"string","example":"Zoom"},"location":{"type":"string","example":"Conference Room"},"sendUpdates":{"type":"string","example":"all"},"entityBaseId":{"type":"string","example":"entity-123"},"entityTypeId":{"type":"number","example":1},"isAllDay":{"type":"boolean","example":false}}}}}},"responses":{"200":{"description":"Calendar event created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Calendar event created successfully"},"eventId":{"type":"string","example":"event-123"}}}}}},"400":{"description":"Error occurred while creating the calendar event","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Failed to create calendar event"}}}}}}}}},"/events/{event_id}":{"patch":{"summary":"Update a calendar event","description":"Update an existing calendar event based on the provided payload.","operationId":"updateEvent","parameters":[{"name":"event_id","in":"path","required":true,"schema":{"type":"string","example":"event-123"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string","example":"Updated Meeting Subject"},"body":{"type":"object","properties":{"contentType":{"type":"string","example":"text/plain"},"content":{"type":"string","example":"Updated meeting content"}}},"start":{"type":"object","properties":{"dateTime":{"type":"string","format":"date-time","example":"2023-01-01T10:00:00Z"},"timeZone":{"type":"string","example":"UTC"}}},"end":{"type":"object","properties":{"dateTime":{"type":"string","format":"date-time","example":"2023-01-01T11:00:00Z"},"timeZone":{"type":"string","example":"UTC"}}},"userAttendees":{"type":"array","items":{"type":"string","example":"user@example.com"}},"leadAttendees":{"type":"array","items":{"type":"string","example":"lead@example.com"}},"contactAttendees":{"type":"array","items":{"type":"string","example":"contact@example.com"}},"otherAttendees":{"type":"array","items":{"type":"string","example":"other@example.com"}},"entityBaseId":{"type":"string","example":"entity-123"},"entityTypeId":{"type":"number","example":1},"isAllDay":{"type":"boolean","example":false},"isOnlineMeeting":{"type":"boolean","example":true},"onlineMeetingProvider":{"type":"string","example":"Zoom"},"location":{"type":"string","example":"Updated Conference Room"}}}}}},"responses":{"200":{"description":"Calendar event updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Calendar event updated successfully"},"eventId":{"type":"string","example":"event-123"}}}}}},"400":{"description":"Error occurred while updating the calendar event","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Failed to update calendar event"}}}}}},"404":{"description":"Calendar event not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Calendar event not found"},"eventId":{"type":"string","example":"event-123"}}}}}}}},"delete":{"summary":"Delete a calendar event","description":"Delete an existing calendar event based on the provided event ID.","operationId":"deleteEvent","parameters":[{"name":"event_id","in":"path","required":true,"schema":{"type":"string","example":"event-123"}}],"responses":{"200":{"description":"Calendar event deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Calendar event deleted successfully"},"eventId":{"type":"string","example":"event-123"}}}}}},"400":{"description":"Error occurred while deleting the calendar event","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Failed to delete calendar event"}}}}}},"404":{"description":"Calendar event not found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Calendar event not found"},"eventId":{"type":"string","example":"event-123"}}}}}}}}},"/events/calendars":{"get":{"summary":"Get calendars","description":"Retrieve calendars based on the provided user ID.","operationId":"getCalendars","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","example":"user-123"}}],"responses":{"200":{"description":"Calendars found","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Calendars found"},"data":{"type":"array","items":{"type":"object"}}}}}}},"400":{"description":"Error occurred while retrieving calendars","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Failed to get calendars"}}}}}}}}},"/generate-integration-app-token":{"post":{"summary":"Generate access and refresh tokens","description":"This endpoint generates access and refresh tokens based on the provided payload.","operationId":"generateTokens","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","example":"user-123"},"name":{"type":"string","example":"John Doe"}}}}}},"responses":{"200":{"description":"Tokens generated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"accessToken":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."},"refreshToken":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."}}}}}},"400":{"description":"Error occurred while generating tokens","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to generate tokens"}}}}}}}}},"/refresh-integration-app-token":{"post":{"summary":"Refresh access token","description":"This endpoint refreshes the access token using the provided refresh token.","operationId":"refreshToken","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"refreshToken":{"type":"string"}}}}}},"responses":{"200":{"description":"Access token refreshed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"accessToken":{"type":"string"}}}}}},"400":{"description":"Error occurred while refreshing the access token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to refresh access token"}}}}}}}}},"/metadata/groups":{"get":{"summary":"Get entity groups","description":"Retrieve entity groups based on the provided query parameters.","operationId":"getEntityGroups","parameters":[{"name":"entity_type_id","in":"query","required":true,"schema":{"type":"string","example":"entity-type-123"}}],"responses":{"200":{"description":"Entity groups retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"group-123"},"name":{"type":"string","example":"Group Name"},"createdAt":{"type":"string","format":"date-time","example":"2023-01-01T00:00:00Z"}}}}}}},"400":{"description":"Missing required query parameter","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Missing required query parameter: entity_type_id"}}}}}},"500":{"description":"Error occurred while retrieving entity groups","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal server error"}}}}}}}}},"/metadata/custom-fields":{"get":{"summary":"Get custom fields","description":"Retrieve custom fields based on the provided query parameters.","operationId":"getCustomFields","parameters":[{"name":"group_id","in":"query","required":true,"schema":{"type":"string","example":"group-123"}}],"responses":{"200":{"description":"Custom fields retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"field-123"},"name":{"type":"string","example":"Field Name"},"type":{"type":"string","example":"text"},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"option-123"},"name":{"type":"string","example":"Option Name"}}}}}}}}}},"400":{"description":"Missing required query parameter","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Missing required query parameter: group_id"}}}}}},"500":{"description":"Error occurred while retrieving custom fields","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal server error"}}}}}}}}},"/metadata/core/tag":{"get":{"summary":"Get tags","description":"Retrieve tags based on the provided query parameters.","operationId":"getTags","parameters":[{"name":"column_config_id","in":"query","required":true,"schema":{"type":"string","example":"column-config-123"}}],"responses":{"200":{"description":"Tags retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"tag-123"},"name":{"type":"string","example":"Tag Name"}}}}}}},"400":{"description":"Missing required query parameter","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Missing required query parameter: column_config_id"}}}}}},"500":{"description":"Error occurred while retrieving tags","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal server error"}}}}}}}}},"/metadata/core/label":{"get":{"summary":"Get labels","description":"Retrieve labels based on the provided query parameters.","operationId":"getLabels","parameters":[{"name":"group_id","in":"query","required":true,"schema":{"type":"string","example":"group-123"}}],"responses":{"200":{"description":"Labels retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"label-123"},"name":{"type":"string","example":"Label Name"}}}}}}},"400":{"description":"Missing required query parameter","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Missing required query parameter: group_id"}}}}}},"500":{"description":"Error occurred while retrieving labels","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal server error"}}}}}}}}},"/metadata/core/stage":{"get":{"summary":"Get stages","description":"Retrieve stages based on the provided query parameters.","operationId":"getStages","parameters":[{"name":"group_id","in":"query","required":true,"schema":{"type":"string","example":"group-123"}}],"responses":{"200":{"description":"Stages retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"stage-123"},"name":{"type":"string","example":"Stage Name"}}}}}}},"400":{"description":"Missing required query parameter","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Missing required query parameter: group_id"}}}}}},"500":{"description":"Error occurred while retrieving stages","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal server error"}}}}}}}}},"/metadata/core/priority":{"get":{"summary":"Get priorities","description":"Retrieve priorities based on the provided query parameters.","operationId":"getPriorities","parameters":[{"name":"group_id","in":"query","required":true,"schema":{"type":"string","example":"group-123"}}],"responses":{"200":{"description":"Priorities retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"priority-123"},"name":{"type":"string","example":"Priority Name"}}}}}}},"400":{"description":"Missing required query parameter","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Missing required query parameter: group_id"}}}}}},"500":{"description":"Error occurred while retrieving priorities","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal server error"}}}}}}}}},"/oauth/authorize":{"get":{"summary":"Authorize user","description":"Authorize the user and generate an authorization code.","operationId":"authorizeUser","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","example":"client-123"}},{"name":"redirect_uri","in":"query","required":true,"schema":{"type":"string","example":"https://example.com/callback"}},{"name":"state","in":"query","required":true,"schema":{"type":"string","example":"state-123"}},{"name":"response_type","in":"query","required":true,"schema":{"type":"string","example":"code"}}],"responses":{"200":{"description":"Authorization code generated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"location":{"type":"string","example":"https://example.com/callback?code=authcode&state=state-123"}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Invalid request"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Unauthorized"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal server error"}}}}}}}}},"/oauth/token":{"post":{"summary":"Generate access and refresh tokens","description":"Generate access and refresh tokens using the authorization code.","operationId":"generateTokens","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"code":{"type":"string","example":"authcode"},"client_id":{"type":"string","example":"client-123"},"client_secret":{"type":"string","example":"secret"},"grant_type":{"type":"string","example":"code"},"redirect_uri":{"type":"string","example":"https://example.com/callback"}}}}}},"responses":{"200":{"description":"Tokens generated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."},"token_type":{"type":"string","example":"Bearer"},"refresh_token":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."},"expires_in":{"type":"number","example":3600}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Invalid request"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Unauthorized"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal server error"}}}}}}}}},"/oauth/refresh":{"post":{"summary":"Refresh access token","description":"Refresh the access token using the refresh token.","operationId":"refreshToken","requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"refresh_token":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."},"grant_type":{"type":"string","example":"refresh_token"},"client_id":{"type":"string","example":"client-123"},"client_secret":{"type":"string","example":"secret"}}}}}},"responses":{"200":{"description":"Access token refreshed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."},"token_type":{"type":"string","example":"Bearer"},"refresh_token":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."},"expires_in":{"type":"number","example":3600}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Invalid request"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Unauthorized"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal server error"}}}}}}}}},"/oauth/me":{"get":{"summary":"Get user info","description":"Retrieve user information based on the access token.","operationId":"getUserInfo","responses":{"200":{"description":"User info retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","example":"user-123"},"name":{"type":"string","example":"John Doe"},"email":{"type":"string","example":"john.doe@example.com"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Unauthorized"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal server error"}}}}}}}}},"/oauth/certs":{"get":{"summary":"Get public keys","description":"Retrieve public keys for verifying JWTs.","operationId":"getPublicKeys","responses":{"200":{"description":"Public keys retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"kid":{"type":"string","example":"key-id"},"use":{"type":"string","example":"sig"},"alg":{"type":"string","example":"RS256"},"kty":{"type":"string","example":"RSA"},"n":{"type":"string","example":"base64-encoded-modulus"},"e":{"type":"string","example":"AQAB"}}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal server error"}}}}}}}}},"/user-delete":{"post":{"summary":"Delete a user","description":"Delete a user based on the provided user ID.","operationId":"deleteUser","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","example":"user-123"}}}}}},"responses":{"200":{"description":"User deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"User deleted successfully"}}}}}},"400":{"description":"Error occurred while deleting the user","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Failed to delete user"}}}}}}}}},"/user-invite":{"post":{"summary":"Invite a user","description":"Invite a user based on the provided email and other details.","operationId":"inviteUser","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","example":"user@example.com"},"redirectTo":{"type":"string","example":"https://example.com/welcome"},"data":{"type":"object","properties":{"tenant_id":{"type":"string","example":"tenant-123"},"tenant_name":{"type":"string","example":"Tenant Name"},"user_role":{"type":"string","example":"admin"},"title_id":{"type":"string","example":"title-123"}}}}}}}},"responses":{"200":{"description":"Invitation has been sent","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Invitation has been sent"}}}}}},"400":{"description":"Error occurred while sending the invitation","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Failed to send invitation"}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Unauthorized"}}}}}}}}},"/user-metadata":{"post":{"summary":"Create a new user","description":"Create a new user based on the provided details.","operationId":"createUser","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"first_name":{"type":"string","example":"John"},"last_name":{"type":"string","example":"Doe"},"email":{"type":"string","example":"john.doe@example.com"},"new_tenant_id":{"type":"string","example":"tenant-123"},"tenant_name":{"type":"string","example":"Tenant Name"},"is_owner":{"type":"boolean","example":true},"created_at":{"type":"string","format":"date-time","example":"2023-01-01T00:00:00Z"},"new_user_id":{"type":"string","example":"user-123"}}}}}},"responses":{"200":{"description":"User created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"User created successfully"}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Invalid user ID"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to create user"}}}}}}}}},"/user-update-state":{"post":{"summary":"Update user state","description":"Update the state of a user based on the provided user ID and state.","operationId":"updateUserState","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string","example":"user-123"},"state":{"type":"string","enum":["Active","Deactivated","Invited"],"example":"Active"}}}}}},"responses":{"200":{"description":"User state updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"User state updated successfully"}}}}}},"400":{"description":"Invalid request or error occurred while updating the user state","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Failed to update user state"}}}}}}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"servers":[{"url":"https://nqbueqvlgxunupklcqzc.supabase.co/functions/v1"}]}