{
  "openapi": "3.1.0",
  "info": {
    "title": "Synaptic Intelligence API",
    "version": "1.0.0",
    "description": "Read what a company's departments find, the next steps they draft and a person's agents' reports. Every operation reads; nothing changes anything. Reference: https://www.synapticintelligence.ai/developers",
    "contact": {
      "name": "Synaptic Intelligence",
      "email": "info@synapticintelligence.ai",
      "url": "https://www.synapticintelligence.ai/developers"
    }
  },
  "servers": [
    {
      "url": "https://app.synapticintelligence.ai/api/v1"
    }
  ],
  "security": [
    {
      "personalKey": []
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "operationId": "getMe",
        "summary": "Who the key belongs to",
        "description": "Use it to test a key.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, revoked or not recognised, or its person has left the company.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The company's plan has stopped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The person's role does not allow this.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the seconds in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/signals": {
      "get": {
        "operationId": "listSignals",
        "summary": "Open signals",
        "description": "What the departments found that needs a person, newest first by first_seen.",
        "parameters": [
          {
            "name": "department",
            "in": "query",
            "required": false,
            "description": "Only this department's signals.",
            "schema": {
              "type": "string",
              "enum": [
                "finance",
                "sales",
                "support",
                "hr",
                "marketing",
                "product",
                "clients",
                "supply",
                "infrastructure",
                "legal",
                "research"
              ]
            }
          },
          {
            "name": "level",
            "in": "query",
            "required": false,
            "description": "high keeps only the pressing ones.",
            "schema": {
              "type": "string",
              "enum": [
                "high"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1 to 50. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Signal"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, revoked or not recognised, or its person has left the company.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The company's plan has stopped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The person's role does not allow this.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the seconds in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/next-steps": {
      "get": {
        "operationId": "listNextSteps",
        "summary": "Drafted next steps",
        "description": "What was drafted after a signal was looked into, newest first by created_at. Nothing here sends it.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1 to 50. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/NextStep"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, revoked or not recognised, or its person has left the company.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The company's plan has stopped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The person's role does not allow this.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the seconds in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/agent-reports": {
      "get": {
        "operationId": "listAgentReports",
        "summary": "Agent reports",
        "description": "Finished runs of the key's own agents, newest first by finished_at. Needs a role that may run agents.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1 to 50. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AgentReport"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The key is missing, revoked or not recognised, or its person has left the company.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "The company's plan has stopped.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The person's role does not allow this.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Wait the seconds in Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "personalKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A personal key made on the Profile in Synaptic Intelligence, under Connect Zapier, Make or n8n. It starts sik_."
      }
    },
    "schemas": {
      "Me": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The person."
          },
          "name": {
            "type": "string",
            "description": "Their name."
          },
          "email": {
            "type": "string",
            "description": "Their email address."
          },
          "company": {
            "type": "string",
            "description": "The company the key reads."
          },
          "company_id": {
            "type": "string",
            "description": "That company's id."
          }
        },
        "required": [
          "id",
          "name",
          "email",
          "company",
          "company_id"
        ]
      },
      "Signal": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The event: the signal and when it was first seen. A signal that clears and comes back gets a new one, so an automation fires once per event."
          },
          "signal_id": {
            "type": "string",
            "description": "The signal itself, the same across events."
          },
          "headline": {
            "type": "string",
            "description": "One line."
          },
          "title": {
            "type": "string",
            "description": "What was found."
          },
          "detail": {
            "type": "string",
            "description": "More on what was found."
          },
          "figure": {
            "type": "string",
            "description": "The figure the signal is about, formatted, such as $12,400. May be empty."
          },
          "figure_label": {
            "type": "string",
            "description": "What the figure is, such as Overdue."
          },
          "department": {
            "type": "string",
            "description": "The department that found it first."
          },
          "departments": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every department reporting it."
          },
          "severity": {
            "type": "integer",
            "description": "1 to 3, 3 the most pressing."
          },
          "pressing": {
            "type": "boolean",
            "description": "Whether it needs attention soon."
          },
          "reports": {
            "type": "integer",
            "description": "How many departments report it."
          },
          "personal": {
            "type": "boolean",
            "description": "Whether it came from your own mailbox, which only you see."
          },
          "status": {
            "type": "string",
            "description": "open."
          },
          "first_seen": {
            "type": "string",
            "format": "date-time",
            "description": "When it was first seen (ISO 8601)."
          },
          "last_seen": {
            "type": "string",
            "format": "date-time",
            "description": "When it was last seen."
          },
          "url": {
            "type": "string",
            "description": "Opens the signal in Synaptic Intelligence."
          }
        },
        "required": [
          "id",
          "signal_id",
          "headline",
          "title",
          "detail",
          "figure",
          "figure_label",
          "department",
          "departments",
          "severity",
          "pressing",
          "reports",
          "personal",
          "status",
          "first_seen",
          "last_seen",
          "url"
        ]
      },
      "NextStep": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The look into the signal that drafted these steps."
          },
          "signal_id": {
            "type": "string",
            "description": "The signal it is about."
          },
          "signal_headline": {
            "type": "string",
            "description": "That signal's headline."
          },
          "departments": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The departments that looked into it."
          },
          "first_step_kind": {
            "type": "string",
            "description": "message, entry, task or note."
          },
          "first_step_title": {
            "type": "string",
            "description": "The first step's title."
          },
          "first_step_audience": {
            "type": "string",
            "description": "Who it is for, such as a customer's accounts team."
          },
          "first_step_system": {
            "type": "string",
            "description": "Which system it goes in, for an entry or a task."
          },
          "first_step_body": {
            "type": "string",
            "description": "The drafted text."
          },
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "action": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                },
                "system": {
                  "type": "string"
                },
                "audience": {
                  "type": "string"
                },
                "body": {
                  "type": "string"
                }
              }
            },
            "description": "Every step drafted, each with kind, action, title, system, audience and body."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was drafted."
          },
          "url": {
            "type": "string",
            "description": "Opens the signal in Synaptic Intelligence."
          }
        },
        "required": [
          "id",
          "signal_id",
          "signal_headline",
          "departments",
          "first_step_kind",
          "first_step_title",
          "first_step_audience",
          "first_step_system",
          "first_step_body",
          "steps",
          "created_at",
          "url"
        ]
      },
      "AgentReport": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The run."
          },
          "agent_id": {
            "type": "string",
            "description": "The agent."
          },
          "agent": {
            "type": "string",
            "description": "The agent's name."
          },
          "headline": {
            "type": "string",
            "description": "One line on what the run found."
          },
          "needs_attention": {
            "type": "boolean",
            "description": "Whether the run found something for you to act on."
          },
          "report": {
            "type": "string",
            "description": "The full report."
          },
          "credits": {
            "type": "integer",
            "description": "Credits the run used."
          },
          "finished_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the run started."
          },
          "url": {
            "type": "string",
            "description": "Opens the agent in Synaptic Intelligence."
          }
        },
        "required": [
          "id",
          "agent_id",
          "agent",
          "headline",
          "needs_attention",
          "report",
          "credits",
          "finished_at",
          "url"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "What happened and what to do."
          }
        },
        "required": [
          "error"
        ]
      }
    }
  }
}
