The Attendi Speech Service API allows you to quickly obtain an accurate transcription of an uploaded audio file. The API is a SaaS solution for healthcare institutions. We have different language models dedicated to a variety of domains within healthcare.
This document will take you through the basic steps to get the Attendi Speech Service API up and running, so that you can integrate it seamlessly into your own application. We will show you how to authenticate your requests to the API, create customers and units, and transcribe audio.
API Keys
The Attendi Speech Service API uses API keys to authenticate requests. Attendi will provide you with your API keys. If you don’t include your API key when making an API request, the Speech Service API returns a 401 Unauthorized error.
Customers
You can create customers that will be part of your tenant. Each customer will get their own API key, so that you can authenticate your request, and identify your customer to us at the same time.
There are two types of API keys: customer and secret.
Customer keys are used to identify your tenant and the specific customer the transcribe request is for. They are not a secret. This means that you can use the publishable key in your JavaScript frontend, or in a mobile application.
Secret keys should be kept confidential and should only be stored on your servers. You must not share your secret API key with any third parties. The secret API key should be treated like a password.
Key
Prefix
Authorization
Customer
ck_
Idenitifies your customer and allows you to transcribe audio directly from a client application where the API key cannot be secured
Secret
sk_
Use the Customers & Units endpoints
Authentication
Authentication to the API is done via a custom HTTP header. Provide your API key in the following header: x-API-key.
All API requests must be made over HTTPS. Requests made over HTTP will fail, so will API requests made without authentication.
Cross-Origin requests are only allowed for the transcribe endpoint, using your customer key from a frontend application.
Security
We implemented and rely on end-to-end TLS/SSL encryption. This allows us to encrypt and securely transmit data to the backend and send the transcribed result to your app. We only accept requests over HTTPS.
Quickstart guide
Customers
There are several customer endpoints that allow you to create, update or retrieve customers. You can create a customer with the ID you use in your internal systems. There is a PUT method that will allow you to upsert a customer. This way, it is easy to syncronize changes from your internal systems to ours, make sure to send the complete request object every time. We also have a PATCH endpoint if you only want to update a specific field. You can retrieve a specific customer by your ID, or retrieve all customers.
Customer API Key
Each customer has it’s own API key. This key starts with ck_**. You can roll the customer key using the roll endpoint, which expects an amount of seconds the key should expire in the request.
Model Type
When creating a customer, you need to provide a default model for the customer. This model determines what Speech to Text model we will use if you do not provide an override value in the transcribe request. The default model can be updated with the PUT and PATCH endpoints. Currently we support the following models: DistrictCare, ResidentialCare and MentalHealthCare.
Units
Units are the representation in our system for a customer’s location or a team. Sometimes, customers want to roll out per location. In order to measure the adoption rate and activity per location/team, we need to know the units.
The endpoints for units are similar to the customer endpoints. As a unit is created within a customer, the URI always starts with /v1/customers/{customerId}/units. You can use PUT to upsert a unit using your own ID to create the unit in the Attendi system. Please make sure to send the entire request object every time. There is also a PATCH endpoint to update an existing unit, using your ID. For each customer, you can retrieve a specific unit by ID, or retrieve all units for a specific customer. When creating a unit, you need to provide the total amount of potential users for the unit. This number helps the customer with the roll-out of the functionality.
Transcribing audio
You can send a POST request to the /v1/speech/transcribe endpoint to obtain a transcription of an audio file using your customer key. The audio file you want to transcribe must be encoded in base64 so that the binary audio data is converted into characters. Additionally, the audio should meet the following specifications:
Single (mono) channel recording
16 kHz sampling rate
16-bit audio recording
In case your file does not meet these requirements, you can use a tool to convert it. For example, ffmpeg is a command line tool, which you can use to convert your audio as follows:
Besides the audio file, it is required to provide a unique UserID. The unique UserID could be anything, for example a UUID. We do not save any personal data, only the unique UserID. We use this UserID to measure usage, and to ensure that we can easily trace back any problems with the API. There is also an option to add the browser’s User-Agent as metadata. We also advise you to send the user’s UnitID in the request, so that usage can be measured.
The output of the API is a JSON object.
{
"transcript": "TEXT"
}
You need to extract the “TEXT” from “transcript” and place it in the correct text field.
Environments
We provide two URLs for you to send your requests to. The sandbox URL should be used for test environments, while the production URL should be used strictly for production environments.