Tenzing MEMO API Developer Docs

Welcome to the Tenzing MEMO API Developer Docs. Use this guide to interact programmatically with our platform. Our API endpoints enable you to manage Binders, generate Memos, and Chat with Tenzing.

Changelog

2023-10-20 - Added authentication information

Authentication

To authenticate with our API, you must include an authentication token as a query parameter in your HTTP request. The authentication token is a unique, secret key that is associated with your account. This token will be used to verify your identity and grant you access to the API resources.

Obtaining an Authentication Token

To obtain an authentication token, please follow these steps:

  1. Create an Account: If you do not already have an account, you need to create one on our platform. Contact our support team or visit our website to sign up.

  2. Generate a Token: After creating an account please contact our support team at hi@tenzingmemo.com to enable API authentication for your account. Once it is enabled you will be able to access the API token on your account page.

  3. Keep the Token Secure: Your authentication token is a sensitive piece of information. Keep it secure and do not share it with anyone who should not have access to your account.

Including the Token in Requests

Once you have obtained an authentication token, you should include it in every API request you make. To include the token:

  • Add the token as a query parameter in the URL of your API request.
  • Use the following format: https://tenzingmemo.com/api/v1/endpoint?token=YOURAUTHENTICATIONTOKEN

Token Revocation

In some cases, tokens may need to be revoked or invalidated. If you suspect your token has been compromised or need to revoke access for any reason, please contact our support team immediately. We can assist you in generating a new token and invalidating the old one.

Error Handling

If there is an error with a request, the API will respond with a HTTP response code and possibly a JSON body.

HTTP Response codes

  • 200 - Success - the request was successful. There will be a JSON body response.
  • 400 - Something went wrong with the request, please look at the body of the error for more detail. Will contain a JSON body with an error message and status code.
  • 401 - Unauthorized, please check the access token. Will not contain a JSON body.
  • 404 - Not found. The entity being requested or accessed was not found. Will not contain a JSON body.

Response Body For 400 responses

  • error (string): A string containing a description of the error, may contain newlines.
  • errorCode (integer): A detail error code, may or many not be present depending on the error type
  • status (integer): The HTTP status code

Example Error Response Body

{
  "error": "The binder could not be created, ticker required",
  "status": 400
}

⬆️ Back to Top

Streaming responses

Several of the APIs available use Server Sent Events (SSE) to return responses. Here is some example javascript code that would retrieve a response and log the messages to the console.

const eventSource = new EventSource("https://tenzingmemo.com/api/v2/memo_section/27171/stream", {
  withCredentials: true,
})

eventSource.addEventListener("message", (event) => {
  console.log("Message received")
  console.log(event.data)
})

eventSource.addEventListener("error", (event) => {
  if (event.eventPhase === EventSource.CLOSED) {
    console.log("Connection closed")
    eventSource.close()
  }
})

Each message is a JSON object of the format:

{
  "type": "chat_completion",
  "content": "data"
}

⬆️ Back to Top

Binders

A Tenzing Binder is a collection of data and documents relevant to a single topic under research. In Tenzing MEMO, the topic of a Binder is always a single stock ticker that you intend to research.

Create a Binder

Before you can write Memos or engage in Chat with Tenzing, you must first create a Binder. The Binder holds the information Tenzing will reference as it writes a Memo or engages in Chat.

Endpoint

POST /api/v2/binders

Parameters

  • ticker (string, required): The ticker symbol of the company for the binder.

Response Fields

  • id (integer): The unique identifier for the binder.
  • created_at (string): String in ISO 8601 format with the created date
  • company_name (string): The name of the company associated with the binder.
  • ticker (string): The ticker symbol of the company.
  • documents (array of strings): An array of document IDs associated with the binder.

Example Response

{
  "id": 2121,
  "created_at": "2023-10-19T14:30:00Z",
  "company_name": "Apple Inc.",
  "ticker": "AAPL",
  "documents": []
}

Retrieve a binder

Endpoint

GET /api/v2/binders/:ticker

Query Parameters

  • ticker (string, required): The ticker symbol of the company for the binder.

Response Fields

  • id (integer): The unique identifier for the binder.
  • created_at (string): String in ISO 8601 format with the created date
  • company_name (string): The name of the company associated with the binder.
  • ticker (string): The ticker symbol of the company.
  • documents (array of strings): An array of document IDs associated with the binder.

Example Response

{
  "id": 2121,
  "created_at": "2023-10-19T14:30:00Z",
  "company_name": "Apple Inc.",
  "ticker": "AAPL",
  "documents": ["121ms81h1711y18", "181hs7sshay11"]
}

Add a Document

Incorporate your own .pdf files into a Binder so that Tenzing can use them as a knowledge resource. Note, adding documents may incur incremental storage charges, please refer to Pricing.

Endpoint

POST /api/v2/documents

Parameters

  • binder_id (string, required): The ticker symbol of the company for the binder.

Response Fields

  • id (string): The unique identifier for the document.
  • created_at (string): String in ISO 8601 format with the created date
  • name (string): The name of the document
  • filename (string): Filename of the document
  • citation (string): Document citation
  • processing_state (string): The processing state of the document, can be one of 'queued', 'pending', 'processing', 'success', 'error'
  • processing_error (string): If there was an error processing the document this field will contain a message with more detail

Retreive a document

GET /api/v2/documents/:id

Query Paramters

  • id (required) - ID of the document to retrieve

Response

  • id (string): The unique identifier for the document.
  • created_at (string): String in ISO 8601 format with the created date
  • name (string): The name of the document
  • filename (string): Filename of the document
  • citation (string): Document citation
  • processing_state (string): The processing state of the document, can be one of 'queued', 'pending', 'processing', 'success', 'error'
  • processing_error (string): If there was an error processing the document this field will contain a message with more detail

Download a document

GET /api/v2/documents/:id

Query Paramters

  • id (required) - ID of the document to download

Response

  • authorized_url (string) - A temporarily authorized S3 url where the document can be retrieved

Remove a Document

DELETE /api/v2/documents/:id

Query Paramters

  • id (required) - ID of the document to remove

Response

There will be no response body, just a HTTP 200 success if removed successfully.

Remove a Binder

DELETE /api/v2/binders/:id

Query Paramters

  • id (required) - ID of the binder to retrieve

Response

There will be no response body, just a HTTP 200 success if removed successfully.

⬆️ Back to Top

Memos

Memos are AI-generated research summaries. Memos are split into distinct sections. Here is the list of currently supported sections and their identifiers to use in API calls:

Section Identifier
Background background
History history
Executives executives
TAM tam
Bull Case bull_case
Bear Case bear_case
Comps comps
Risks risks
Valuation Discussion valuation_discussion
Company News company_news

Write a Memo Section

Request that Tenzing write or rewrite the specified memo section. When writing a memo section, Tenzing will refer to any information that is available in the Binder you specify.

Endpoint

POST /api/v2/memo_section

NOTE: This can take a minute or two to generate, the reponse will return immediately with a 'pending' or 'queued' status. You can poll the response as needed with a GET request, or stream (see below). If polling please note that the response text will only populate once fully generated and polling is limited to once per second.

Parameters

  • binder_id (string, required): The ticker symbol of the company of the binder to use
  • memo_section_type (string, required): The identifier of the memo section to be writtern, refer to list of sections given above.
  • guidance (string, optional): Optional. Provides supplementary instructions to Tenzing about how you would like the section written. Your guidance should be provided in plain English, as if you were guiding or instructing a human who was assisting you to write the memo section.

Response Fields

  • id (string): The unique identifier for the new memo section
  • created_at (string): String in ISO 8601 format with the created date
  • section_type (string): The identifer of the memo section, refer to list above
  • name (string): A descriptive name for the memo section type, refer to list above
  • state (string): The state of the memo section. One of 'pending', 'queued', 'processing', 'success', 'error'

Retrieve a Memo Section

Endpoint

GET /api/v2/memo_section/:id

Query Parameters

  • id: Required. ID of the memo section

Response Fields

  • id (string): The unique identifier for memo section
  • created_at (string): String in ISO 8601 format with the created date
  • section_type (string): The identifer of the memo section, refer to list above
  • name (string): A descriptive name for the memo section type, refer to list above
  • state (string): The state of the memo section. One of 'pending', 'queued', 'processing', 'success', 'error'
  • text (string): The text of the generated memo section.
  • notes (array): An array of notes used to generate the section

Example response

{
  "id": 76242,
  "created_at": "2023-10-19T14:30:00Z",
  "section_type": "background",
  "name": "Background",
  "state": "generating",
  "text": null,
  "notes": [
    {
      "id": 129111,
      "doc_id": "1nsgbb171bb11",
      "page_num": 12,
      "doc_name": "apple_10q_q4.pdf",
      "doc_citation": "Apple 10Q 2023 Q4",
      "snippet": "This is a short note snippet"
    },
    {
      "id": 129112,
      "doc_id": "1nfh18gbb171bb12",
      "doc_name": "apple_10q_q4.pdf",
      "doc_citation": "Apple 10Q 2023 Q4",
      "snippet": "This is another short note snippet"
    }
  ]
}

Stream a Memo Section

GET /api/v2/memo_section/:id/stream

NOTE: This requires creating a memo section first via POST request above.

Response

The response will be sent via server sent events (SSE) containing the text of the memo section as it generates. If the memo section is currently generating, or has already generated then the text that is currently available will be sent after connection. See streaming section above for format of responses and example code.

Generate Follow-Up Questions

If you would like Tenzing to recommend some follow-up questions based on the information in a specific memo section, use this endpoint.

Endpoint

POST /api/v2/memo_section/:id/follow_ups

NOTE: This can take a minute or two to generate, the reponse will return immediately with a 'pending' or 'queued' status. You can poll the response as needed with a GET request. Please note that the response text will only populate once fully generated and polling is limited to once per second.

Query parameters

  • id: Required. Identifies the section for which the follow-up questions will be generated.

Response Fields

  • id (string): Unique id for this set of followups
  • created_at (string): String in ISO 8601 format with the created date
  • memo_section_id (string): ID of the memo section these follow ups are associated with.
  • questions (array): Array of generated follow up questions
  • state: (string): One of 'pending', 'queued', 'processing', 'success', 'error'

Example response

{
  "id": 121121,
  "created_at": "2023-10-19T14:30:00Z",
  "memo_section_id": 12311,
  "state": "generating",
  "questions": []
}

Retrieve Follow-Up Questions

Query parameters

  • id: Required. Identifies the set of previously generated follow-up questions to retrieve.

Response Fields

  • id (string): Unique id for this set of followups
  • created_at (string): String in ISO 8601 format with the created date
  • memo_section_id (string): ID of the memo section these follow-ups are associated with.
  • questions (array): Array of generated follow-up questions
  • state: (string): . One of 'pending', 'queued', 'processing', 'success', 'error'

Example response

{
  "id": 121121,
  "created_at": "2023-10-19T14:30:00Z",
  "memo_section_id": 12311,
  "state": "success",
  "questions": [
    "In Q4 what were the driving factors behind the drop in macbook sales for Apple?",
    "What have been the changes in leadership at Apple over the last year?"
  ]
}

⬆️ Back to Top

Chat

Engage in conversation with Tenzing about the topic covered by a Binder or Memo section.

Create a Chat Message

Endpoint

POST /api/v2/memo_section/:id/chat_message

NOTE: This can take a minute or two to generate, the reponse will return immediately with a 'pending' or 'queued' status. You can poll the response as needed with a GET request or stream. Please note that if polling the response text will only populate once fully generated and polling is limited to once per second.

Query parameters

  • id (string, required): ID of the memo section
  • query (string, required): Your question or message to Tenzing. Tenzing will respond to your query.

Response Fields

  • id (string): Unique id for this chat
  • created_at (string): String in ISO 8601 format with the created date
  • memo_section_id (string): ID of the memo section these follow ups are associated with.
  • questions (array): Array of generated follow up questions
  • state: (string): . One of 'pending', 'queued', 'processing', 'success', 'error'

Example Response

{
  "id": 187221,
  "created_at": "2023-10-19T14:30:00Z",
  "type": "question",
  "question": "What is the outlook for Apple in Q4",
  "answer": null,
  "state": "generating"
}

Stream a Chat Message

GET /api/v2/memo_section/:id/chat_message/:message_id

NOTE: This requires creating a chat message first via POST request above.

Response

The response will be sent via server sent events (SSE) containing the text of the responses it generates. If the chat message is currently generating, or has already generated then the text that is currently available will be sent after connection. See streaming section above for format of responses and example code.

Retrieve a Chat History

Endpoint

GET /api/v2/memo_section/:id

Query Parameters

  • id (string, required): ID of the memo section #### Response

An Array of chat messages

Example response

[
  {
    "id": 187221,
    "created_at": "2023-10-19T14:32:00Z",
    "type": "question",
    "question": "What is the outlook for Apple in Q4",
    "answer": null,
    "state": "generating"
  },
  {
    "id": 187229,
    "created_at": "2023-10-19T14:30:00Z",
    "type": "question",
    "question": "When will apple release new devices and how will that affect the current lineup?",
    "answer": "This is a fully generated answer",
    "state": "success"
  }
]

⬆️ Back to Top

Administration

Get Tokens Used

Retrieve a month-to-date summary of token usage.

Endpoint

GET /api/v2/account/usage

Response

{
  "start_date": "2023-10-01",
  "end_date": "2023-10-20",
  "tokens_used": 321812,
  "tokens_limit": 6500000
}

⬆️ Back to Top