{
  "info": {
    "name": "AlphaSense SuperAnalyst API (Beta)",
    "description": "Fill in clientId, clientSecret, and refreshToken, then run \"Get access token\". Keep a filled-in copy private. Guide: https://developer.alpha-sense.com/superanalyst-api/quickstart",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{accessToken}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://api.research.alpha-sense.com/superanalyst/v1",
      "type": "string"
    },
    {
      "key": "superanalystId",
      "value": "default",
      "type": "string"
    },
    {
      "key": "clientId",
      "value": "",
      "type": "string"
    },
    {
      "key": "clientSecret",
      "value": "",
      "type": "string"
    },
    {
      "key": "refreshToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "accessToken",
      "value": "",
      "type": "string"
    },
    {
      "key": "sessionId",
      "value": "",
      "type": "string"
    },
    {
      "key": "artifactId",
      "value": "",
      "type": "string"
    },
    {
      "key": "fileId",
      "value": "",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Authentication",
      "item": [
        {
          "name": "Get access token",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "const token = pm.response.json()",
                  "pm.collectionVariables.set('accessToken', token.access_token)",
                  "if (token.refresh_token) pm.collectionVariables.set('refreshToken', token.refresh_token)"
                ]
              }
            }
          ],
          "request": {
            "auth": {
              "type": "noauth"
            },
            "method": "POST",
            "header": [],
            "body": {
              "mode": "urlencoded",
              "urlencoded": [
                {
                  "key": "grant_type",
                  "value": "refresh_token"
                },
                {
                  "key": "client_id",
                  "value": "{{clientId}}"
                },
                {
                  "key": "client_secret",
                  "value": "{{clientSecret}}"
                },
                {
                  "key": "refresh_token",
                  "value": "{{refreshToken}}"
                }
              ]
            },
            "url": "https://auth.research.alpha-sense.com/oauth/token"
          }
        }
      ]
    },
    {
      "name": "Service",
      "item": [
        {
          "name": "Health check",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/health",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "health"
              ]
            },
            "auth": {
              "type": "noauth"
            }
          }
        }
      ]
    },
    {
      "name": "Sessions",
      "item": [
        {
          "name": "Create a session and run its first turn",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/sessions",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "sessions"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"input\": {\n    \"text\": \"What were the key themes in NVIDIA's latest earnings call?\"\n  }\n}"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "pm.collectionVariables.set('sessionId', encodeURIComponent(pm.response.json().id))"
                ]
              }
            }
          ]
        },
        {
          "name": "List the caller's sessions",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/sessions",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "sessions"
              ],
              "query": [
                {
                  "key": "limit",
                  "value": "",
                  "description": "1–200, default 20.",
                  "disabled": true
                },
                {
                  "key": "cursor",
                  "value": "",
                  "description": "The `next_cursor` from the previous page.",
                  "disabled": true
                }
              ]
            }
          }
        },
        {
          "name": "Retrieve a session's status and metadata",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/sessions/{{sessionId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "sessions",
                "{{sessionId}}"
              ]
            }
          }
        },
        {
          "name": "Post a follow-up message into a session",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/sessions/{{sessionId}}/messages",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "sessions",
                "{{sessionId}}",
                "messages"
              ]
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"input\": {\n    \"text\": \"Which of those themes did analysts push back on?\"\n  }\n}"
            }
          }
        },
        {
          "name": "List a session's messages",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/sessions/{{sessionId}}/messages",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "sessions",
                "{{sessionId}}",
                "messages"
              ],
              "query": [
                {
                  "key": "limit",
                  "value": "",
                  "description": "1–200, default 200. Keeps the newest messages.",
                  "disabled": true
                }
              ]
            }
          }
        },
        {
          "name": "Cancel the session's current execution",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/sessions/{{sessionId}}/cancel",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "sessions",
                "{{sessionId}}",
                "cancel"
              ]
            }
          }
        },
        {
          "name": "Stream a session's live events",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "text/event-stream"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/sessions/{{sessionId}}/events",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "sessions",
                "{{sessionId}}",
                "events"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Artifacts",
      "item": [
        {
          "name": "List the artifacts a session produced",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/sessions/{{sessionId}}/artifacts",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "sessions",
                "{{sessionId}}",
                "artifacts"
              ],
              "query": [
                {
                  "key": "limit",
                  "value": "",
                  "description": "1–100, default 20.",
                  "disabled": true
                },
                {
                  "key": "cursor",
                  "value": "",
                  "description": "The `next_cursor` from the previous page.",
                  "disabled": true
                }
              ]
            }
          }
        },
        {
          "name": "Retrieve one artifact's metadata",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/artifacts/{{artifactId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "artifacts",
                "{{artifactId}}"
              ]
            }
          }
        },
        {
          "name": "Read an artifact's content inline",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/artifacts/{{artifactId}}/content",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "artifacts",
                "{{artifactId}}",
                "content"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Files",
      "item": [
        {
          "name": "List a directory in the SuperAnalyst's workspace",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/files",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "files"
              ],
              "query": [
                {
                  "key": "path",
                  "value": "",
                  "description": "Folder path from an earlier listing. Omit for the workspace root.",
                  "disabled": true
                },
                {
                  "key": "limit",
                  "value": "",
                  "description": "1–100, default 20.",
                  "disabled": true
                },
                {
                  "key": "cursor",
                  "value": "",
                  "description": "The `next_cursor` from the previous page.",
                  "disabled": true
                }
              ]
            }
          }
        },
        {
          "name": "Retrieve one workspace entry's metadata",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/files/{{fileId}}",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "files",
                "{{fileId}}"
              ]
            }
          }
        },
        {
          "name": "Read a file's content inline",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/superanalysts/{{superanalystId}}/files/{{fileId}}/content",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "superanalysts",
                "{{superanalystId}}",
                "files",
                "{{fileId}}",
                "content"
              ]
            }
          }
        }
      ]
    }
  ]
}
