openapi.json 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. {
  2. "openapi": "3.0.3",
  3. "info": {
  4. "title": "Agencii Platform API",
  5. "version": "1.0.0",
  6. "description": "Reference documentation for the Agencii Platform API. Provides endpoints allowing you to run your agents on custom backends or on other unsupported channels. ⚡ Live Postman Example: https://www.postman.com/vrsen-ai/agencii-api/overview"
  7. },
  8. "servers": [
  9. {
  10. "url": "https://agency-swarm-app-japboyzddq-uc.a.run.app",
  11. "description": "Production server"
  12. }
  13. ],
  14. "components": {
  15. "securitySchemes": {
  16. "BearerAuth": {
  17. "type": "http",
  18. "scheme": "bearer",
  19. "bearerFormat": "JWT",
  20. "description": "Platform token required for authentication. Find or create one inside Profile Icon > API Keys. Example: Bearer sk-agencii-..."
  21. }
  22. },
  23. "schemas": {
  24. "Attachment": {
  25. "type": "object",
  26. "description": "Object representing a file attachment.",
  27. "properties": {
  28. "file_id": { "type": "string", "description": "The unique identifier for the file. Example: file-0SY0lLXWCSSBIOb2gu8UolxH" },
  29. "tools": {
  30. "type": "array",
  31. "items": { "$ref": "#/components/schemas/Tool" },
  32. "description": "An array of tool objects specifying tools to be used with the file. Example: [{ \"type\": \"file_search\" }]"
  33. }
  34. },
  35. "required": ["file_id", "tools"]
  36. },
  37. "Tool": {
  38. "type": "object",
  39. "description": "Object representing a tool to be used.",
  40. "properties": {
  41. "type": { "type": "string", "description": "The type of tool to be used. Example: file_search" }
  42. },
  43. "required": ["type"]
  44. },
  45. "GetResponseRequest": {
  46. "type": "object",
  47. "description": "Request body for the /get_response endpoint.",
  48. "properties": {
  49. "message": { "type": "string", "description": "The message content to be processed by the agent. Example: \"Hey! How are you?\"" },
  50. "apiIntegrationId": { "type": "string", "description": "The unique identifier for the API integration being used. Example: \"dpCD7snQ0tCWrdtp6UhZ\"" },
  51. "chatId": { "type": "string", "description": "The unique identifier for the chat session. If provided, continues the chat with the previous context. Example: \"plOQeH3hW7UKiACqEdAx\"", "nullable": true },
  52. "attachments": {
  53. "type": "array",
  54. "items": { "$ref": "#/components/schemas/Attachment" },
  55. "description": "An array of attachment objects to include files and specify tools for processing. Example: [{\"file_id\": \"file-123\", \"tools\": [{\"type\": \"file_search\"}]}]",
  56. "nullable": true
  57. },
  58. "additionalInstructions": { "type": "string", "description": "Appends additional instructions at the end of the agent's instructions for the run. Useful for modifying behavior per-run. Example: \"User name: John Smith\"", "nullable": true },
  59. "aliasChatId": { "type": "string", "description": "An alternative to chatId which allows using custom identifiers for persisting chats through third party integrations. Example: \"custom-identifier\"", "nullable": true }
  60. },
  61. "required": ["message", "apiIntegrationId"]
  62. },
  63. "GetResponseResponse": {
  64. "type": "object",
  65. "description": "Response body for the /get_response endpoint when textOnly mode is disabled.",
  66. "properties": {
  67. "chatId": { "type": "string", "description": "The unique identifier for the chat session. Example: \"FVfA971B3fnBH4S1OKlo\"" },
  68. "createdAt": { "type": "string", "format": "date-time", "description": "The timestamp when the response was created (ISO 8601 format). Example: \"2024-08-06T02:02:37.533913\"" },
  69. "threadId": { "type": "string", "description": "The unique identifier for the underlying thread. Example: \"thread_ruUj69CyW2STm8Zog0HXkvIJ\"" },
  70. "assistantId": { "type": "string", "description": "The unique identifier for the assistant that responded. Example: \"J3NQwdHxqm9jvWFpOwFk\"" },
  71. "name": { "type": "string", "description": "The name of the API integration used. Example: \"Test API Integration\"" },
  72. "message": { "$ref": "#/components/schemas/Message", "description": "The message object containing the agent's response details." },
  73. "numMessages": { "type": "integer", "description": "The total number of messages in the chat thread. Example: 2" },
  74. "aliasChatId": { "type": "string", "description": "Alternative chat identifier used for persisting chats through third party integrations. Example: \"r14ud3CyX21Tm8Zog0HKJkvZJ\"" }
  75. }
  76. },
  77. "Message": {
  78. "type": "object",
  79. "description": "Object representing a message within the chat.",
  80. "properties": {
  81. "id": { "type": "string", "description": "The unique identifier for the message. Example: \"msg_nH4zWgFW7dCUoNQ5msLJNBUd\"" },
  82. "content": { "type": "string", "description": "The content of the message. Example: \"The secret phrase is: **papaya tangerine**.\"" },
  83. "role": { "type": "string", "description": "The role of the message sender (e.g., 'assistant', 'user'). Example: \"assistant\"" },
  84. "type": { "type": "string", "description": "The type of message (e.g., 'text'). Example: \"text\"" },
  85. "createdAt": { "type": "string", "format": "date-time", "description": "The timestamp when the message was created (ISO 8601 format). Example: \"2024-08-06T02:02:37.533913\"" },
  86. "references": { "type": "array", "items": { "type": "string" }, "description": "An array of references associated with the message." },
  87. "fileIds": { "type": "array", "items": { "type": "string" }, "description": "An array of file IDs associated with the message. Example: [\"file-wRZy12uetHH9dVEpR6PhE92j\"]" },
  88. "assistantData": { "type": "object", "nullable": true, "description": "Additional assistant-related data." },
  89. "functions": { "type": "object", "nullable": true, "description": "Additional function-related data." }
  90. }
  91. },
  92. "CreateNewChatRequest": {
  93. "type": "object",
  94. "description": "Request body for the /create_new_chat endpoint.",
  95. "properties": {
  96. "apiIntegrationId": { "type": "string", "description": "The unique identifier of the API integration for which to create the chat. Example: \"dpCD7snQ0tCWrdtp6UhZ\"" }
  97. },
  98. "required": ["apiIntegrationId"]
  99. },
  100. "CreateNewChatResponse": {
  101. "type": "object",
  102. "description": "Response body for the /create_new_chat endpoint.",
  103. "properties": {
  104. "chatId": { "type": "string", "description": "The unique identifier for the newly created chat. Example: \"FVfA971B3fnBH4S1OKlo\"" }
  105. }
  106. },
  107. "ErrorResponse": {
  108. "type": "object",
  109. "description": "Standard error response format.",
  110. "properties": {
  111. "detail": { "type": "string", "description": "A detailed error message." }
  112. }
  113. }
  114. }
  115. },
  116. "security": [ { "BearerAuth": [] } ],
  117. "paths": {
  118. "/create_new_chat": {
  119. "post": {
  120. "summary": "Create new chat",
  121. "description": "Creates a new chat instance for a user based on a provided API integration. Requires a valid platform token in the headers for authentication. Ensure the apiIntegrationId corresponds to an existing integration.",
  122. "requestBody": {
  123. "required": true,
  124. "content": {
  125. "application/json": {
  126. "schema": { "$ref": "#/components/schemas/CreateNewChatRequest" }
  127. }
  128. }
  129. },
  130. "responses": {
  131. "200": {
  132. "description": "Chat created successfully. Returns the unique chatId for the new chat.",
  133. "content": {
  134. "application/json": {
  135. "schema": { "$ref": "#/components/schemas/CreateNewChatResponse" }
  136. }
  137. }
  138. },
  139. "400": {
  140. "description": "Bad Request. Occurs if the request body is missing required fields or the JSON payload is malformed.",
  141. "content": {
  142. "application/json": {
  143. "schema": { "$ref": "#/components/schemas/ErrorResponse" },
  144. "example": { "detail": "Your JSON payload is missing required fields. Please consult the documentation." }
  145. }
  146. }
  147. },
  148. "401": {
  149. "description": "Unauthorized. Occurs if the Authorization header is missing or contains an invalid token.",
  150. "content": {
  151. "application/json": {
  152. "schema": { "$ref": "#/components/schemas/ErrorResponse" },
  153. "example": { "detail": "Invalid or missing authorization token." }
  154. }
  155. }
  156. },
  157. "500": {
  158. "description": "Internal Server Error. Occurs if there is an issue on the server side while processing the request.",
  159. "content": {
  160. "application/json": {
  161. "schema": { "$ref": "#/components/schemas/ErrorResponse" },
  162. "example": { "detail": "An unexpected error occurred while processing your request." }
  163. }
  164. }
  165. }
  166. },
  167. "security": [ { "BearerAuth": [] } ]
  168. }
  169. },
  170. "/get_response": {
  171. "post": {
  172. "summary": "Get response",
  173. "description": "Processes a message using the specified API integration and returns a response from the agent. Requires a valid platform token. Ensure the apiIntegrationId is valid. Supports continuing existing chats via chatId or aliasChatId and attaching files with tools.",
  174. "requestBody": {
  175. "required": true,
  176. "content": {
  177. "application/json": {
  178. "schema": { "$ref": "#/components/schemas/GetResponseRequest" }
  179. }
  180. }
  181. },
  182. "responses": {
  183. "200": {
  184. "description": "Successful response. The format varies depending on the `textOnly` mode configured for the API Integration. If `textOnly` is enabled, the response is plain text. Otherwise, it's application/json.",
  185. "content": {
  186. "application/json": {
  187. "schema": { "$ref": "#/components/schemas/GetResponseResponse" }
  188. },
  189. "text/plain": {
  190. "schema": { "type": "string", "example": "This is a final message response from the bot." }
  191. }
  192. }
  193. },
  194. "400": {
  195. "description": "Bad Request. Occurs if the request body is missing required fields or the JSON payload is malformed.",
  196. "content": {
  197. "application/json": {
  198. "schema": { "$ref": "#/components/schemas/ErrorResponse" },
  199. "example": { "detail": "Your JSON payload is missing required fields. Please consult the documentation." }
  200. }
  201. }
  202. },
  203. "401": {
  204. "description": "Unauthorized. Occurs if the Authorization header is missing or contains an invalid token.",
  205. "content": {
  206. "application/json": {
  207. "schema": { "$ref": "#/components/schemas/ErrorResponse" },
  208. "example": { "detail": "Invalid or missing authorization token." }
  209. }
  210. }
  211. },
  212. "500": {
  213. "description": "Internal Server Error. Occurs if there is an issue on the server side while processing the request.",
  214. "content": {
  215. "application/json": {
  216. "schema": { "$ref": "#/components/schemas/ErrorResponse" },
  217. "example": { "detail": "An unexpected error occurred while processing your request." }
  218. }
  219. }
  220. }
  221. },
  222. "security": [ { "BearerAuth": [] } ]
  223. }
  224. }
  225. }
  226. }