Guide

This page provides a comprehensive guide for setting up a connection to the SensusAccess API.

Table of Contents

  1. Getting started
  2. Overview
  3. Prerequisites
  4. General Structure
  5. Supported API request
    1. Post
    2. GetStatus
    3. GetJobStatus
    4. GetResult
    5. Delete
    6. Other request methods
  6. General workflow
  7. Demo API call and source code
  8. Worflow details
    1. Accessibility
    2. Mp3
    3. Ebook
    4. Braille
    5. Daisy
    6. Translation
  9. Example workflows

Getting started

In order to use the SensusAccess API please register first for an account. Once your registration is complete Sensus will review and activate the account for using the API. The account status can be checked after logging in to the SensusAccess API account. A User ID and API key will also be associated with the account and will be used to authenticate the API requests. Please make sure these are not disclosed to unauthorized users.

Overview

For the purpose of this document the name “endpoint(s)” will be used when providing general information about all endpoints. Information relevant to each component will be provided by referencing their names. The supported conversions of the API are Braille, MP3, Daisy, Ebook and Accessibility. They are collectively referred to in this document as "workflow(s)" or "conversion workflow(s)". References to parameters that must be supplied at runtime are marked by using the name or description of the parameter inside curly brackets, such as: "{your job ID}". The main path for the API is https://api.sensusaccess.com/job.

Prerequisites

In order to use the API, the account must be registered and activated.

The authentication is done using a token based authentication scheme, more specifically the HAWK authentication scheme. Each POST request to the API must be accompanied by a HAWK Authorization header. Third party libraries exist in most major programming languages that can create the HAWK Authorization header automatically. The header is created using the user id, api key fields and the sha256 encryption algorithm. More advanced parameters for HAWK should be generated by the specific libraries.

In order to make sure that the endpoints are called correctly and that the authentication is set up accordingly it is recommended to use Postman or similar software for creating test requests.

To make sure the account is registered successfully for using the API it is possible to call the following endpoint using a GET method and the HAWK authorization header: https://api.sensusaccess.com/job/GetMessage. It will return the account user name if successful or "Anonymous" otherwise.

General Structure

The API supports the same conversion workflows as SensusAccess, therefore its structure is made to reflect this similarity. The following job POSTing endpoints are available:

More details regarding the creation of each conversion request is provided in their respective sections below.

Supported API requests

Please note that only the POST requests require using the HAWK authorization header.

Post

Request url: https://api.sensusaccess.com/job/{Workflow name}

Http method: POST

Requires authorization header: Yes

The POST request contains all the necessary parameters for starting a job in the API, including the file to be converted. The POST content type is "multipart/form-data". Each request returns a unique ID used to track and retrieve the job. Please store this ID as there is no other way to retrieve the converted file afterwards. The job ID is in the form of: “ca427b75-bb66-e511-91f0-1c6f65d84158”.

This ID will be used in the next three methods as an URL encoded parameter following the endpoint path.

GetStatus

Request url: https://api.sensusaccess.com/job/GetStatus?Id={your job ID}

Http method: GET

Requires authorization header: No

This method will return a status code for the respective job. Their values and interpretation are as follows:

Code Meaning Description
1 Done The job is finished and the result can be retrieved
2 Cancelled The job has been cancelled by the user
3 Started The job has been started
4 Queued The job is queued for starting
5 Processing The job is being processed
6 Created The job is created but not started
-1 Error An internal error prevented the job from completing successfully

GetJobStatus

Request url: https://api.sensusaccess.com/job/GetJobStatus?Id={your job ID}

Http method: GET

Requires authorization header: No

This method will return JobID, Status, ErrorCode, ErrorMessage for the respective job. This API is an alternate to the GetStatus and the status code interpretation are exactly as above in the GetStatus. We recommend using GetJobStatus over GetStatus because this endpoint gives you Status along with an error message if the status code is -1.

   
        {
        "JobID": "67ca0072-db8f-ec11-8e57-9eb6d0c418a3",
        "JobStatus": 3,
        "ErrorCode": null,
        "ErrorMessage": null
        }   
    
You can download the complete error codes at Download error codes.

GetResult

Request url: https://api.sensusaccess.com/job/GetResult?Id={your job ID}

Http method: GET

Requires authorization header: No

The GetResult request will return the converted file. The result file will have the same name as the input file. Please make sure that the GetStatus request returns the value 1 before attempting to return the file result.

Delete

Request URL: https://api.sensusaccess.com/job/Delete?Id={your job ID}

HTTP method: DELETE

Requires authorization header: Yes

Please note that all jobs are stored on the SensusAccess servers for 7 days. However, it is also possible to issue a delete request after the job is finished. Please note that the job cannot be recovered afterwards. It is recommended to use the delete request when the job status returns an error message in order to not run into unexpected conflicts when retrying the same conversion.

Other request methods

Other GET request methods exist to aid the creation of the POST request. They provide valid lists of input parameter values, such as supported languages or output formats. Further details are provided when presenting each job type.

General workflow

The workflow described below should be followed for all conversion types (Accessibility, Mp3, Ebook, Braille, Daisy).

  1. POST the authenticated job request to the desired endpoint
  2. Store the ID of the job
  3. Repeat: Call GetStatus with the saved job ID in regular time intervals. Repeat until the job status value equals is either 1, 2 or -1, or some predefined timeout. There is also an alternate API GetJobStatus which gives you an object with JobID, Status, ErrorCode, ErrorMessage. We recommend you use GetJobStatus over GetStatus because the purpose of the GetStatus is to support the older clients.
  4. Depending on job status from step 3.
    1. If job status = 1. Call GetResult with the saved job ID to retrieve the converted file.
    2. If job status = 2. Notify the user that the job has been cancelled.
    3. If job status = -1. Notify the user that a conversion error has occurred.
  5. Delete the job.
  6. End of workflow.
    Note: If you POST the job to the API with the optional parameter DeliveryMethod=Email and DeliveryEmail=some email address, don't delete the job because if you delete the job the API might be unable to send the email. This could be the case that your application could delete the before email scheduler picket the job to send in the email. By POSTing the job to API with DeliveryMethod=Email, you could also avoid the above other steps except for the first one because the API will be responsible to deliver the converted result to a given email address once the conversion is completed. But it depends on your implementations.

Example API call and source code

The demo application is a console application developed in C# and Visual Studio (2015 or higher). The application demonstrates how to post a job to the API, how to get the status of the posted job, how to fetch the result and how to delete the job from the server after conversion. To run the demo application, you are required to have a UserId and an API key. The sample code is well documented and it's clearly mentioned where to put UserId and API Key in the code. There are two dependencies namely Thinktecture.IdentityModel.Hawk and Newtonsoft.Json which are available at nuget. You can download the source code of the demo application at Download source code

Workflow details

The specific details for constructing the POST requests for each workflow is presented here. Unless specified otherwise both the string and numeric representations for the parameters are valid. Where defined it is recommended to use the provided GET link in order to see a list of supported parameter values.

Accessibility

Parameter name Valid value Description
FileContent The input document can be in any file format supported by SensusAccess for this specific workflow
TargetDocumentFormat OFF_MSWord doc - Microsoft Word
OFF_MSExcel xls - Microsoft Excel
OFF_RTF rtf - Rich Text Format
OFF_XML xml - Markup document
OFF_PDF pdf - Tagged PDF (text over image)
OFF_PDFA pdf – Tagged PDF
OFF_PDFv2 pdf - Tagged PDF (image over text)
OFF_Text txt - Windows text
OFF_CSV csv - Comma separated
OFF_HTML htm - HTML
OFF_DOCX docx - Microsoft Word
OFF_XLSX xlsx - Microsoft Excel
OFF_Handouts pdf - Note handouts with slides as images
OFF_LaTeXML html - HTML5/MATHML
DeliveryMethod Email DeliveryMethod is an optional and possible value that can be provided are Email and Download. If you do not provide the option while POSTing the job to the API, the default value Download is assumed and you need to pull the conversion result from the server and deliver it to the user. If you provide the DeliveryMethod=Email, the API will deliver the converted result to the email address which is provided in the DeliveryEmail.
Download
DeliveryEmail Your email address It is an optional field and if you provide DeliveryMethod=Email, it is mandatory to provide the email address where the service can deliver the conversion result.
UILanguage en-GB UILanguage is an optional field and it is used to pick up the email template and error messages according to the language you supplied. The default language is British English (en-GB) if you do not provide any. The supported languages at the moment are British English (en-GB), American English (en-US), Australian English (en-AU), and Danish (da-DK).
en-US
en-AU
da-DK
it-IT

Mp3

Parameter name Valid value Description
FileContent The input document can be in any file format supported by SensusAccess for this specific workflow
Language enUS American English
arEG Arabic
arEG Arabic English Bilingual

To get Arabic English Bilingual voice, it is mandatory to pass VoicePropriety property, otherwise it will generate the result as Arabic. See VoicePropriety property for detail.
enGB British English
bgBG Bulgarian
zhHK Chinese (Cantonese)
zhCN Chinese (Mandarin)
zhTW Chinese (Taiwanese)
csCZ Czech
daDK Danish
nlNL Dutch
fiFI Finnish
frFR French
deDE German
elGR Greek
klGL Greenlandic
huHU Hungarian
isIS Icelandic
itIT Italian
jaJP Japanese
koKR Korean
ltLT Lithuanian
nbNO Norwegian
plPL Polish
ptPT Portuguese
roRO Romanian
ruRU Russian
skSK Slovak
slSI Slovenian
esES Spanish (Castilian)
esCO Spanish (Latin American)
svSE Swedish
cyGB Welsh
caES Catalan
SpeedOptions Fastest = 10 Any values between -10 (the slowest) and 10 (the fastest) can be used. These values are indicative of the equivalet SensusAccess configuration.
Faster = 7
Fast = 3
Normal = 0
Slow = -3
Slower= -7
Slowest = -10
VoicePropriety Male = 1 You don't need to pass VoicePropriety in all languages. In case of Danish, Dutch, Hungarian, Icelandic and Welsh, you have to pass gender options Male or Female.

In case of Lithuanian, both gender (Male or Female) and age (Older or Younger) options can be provided.

If more voice proprieties are desired for the same conversion it is possible to use a list of semicolon (;) separated values. For example, if you want Lithuanian voice gender as Male and Age as Older, you have to pass VoicePropriety as Male;Older.

If you want Arabic English Bilingual voice, it is mandatory to send Bilingual in addition to Language = arEG.
Female = 2
Older = 3
Younger = 4
Bilingual = 5
None = 0
DeliveryMethod Email DeliveryMethod is an optional and possible value that can be provided are Email and Download. If you do not provide the option while POSTing the job to the API, the default value Download is assumed and you need to pull the conversion result from the server and deliver it to the user. If you provide the DeliveryMethod=Email, the API will deliver the converted result to the email address which is provided in the DeliveryEmail.
Download
DeliveryEmail Your email address It is an optional field and if you provide DeliveryMethod=Email, it is mandatory to provide the email address where the service can deliver the conversion result.
UILanguage en-GB UILanguage is an optional field and it is used to pick up the email template and error messages according to the language you supplied. The default language is British English (en-GB) if you do not provide any. The supported languages at the moment are British English (en-GB), American English (en-US), Australian English (en-AU), and Danish (da-DK).
en-US
en-AU
da-DK
it-IT

Ebook

Parameter name Valid value Description
FileContent The input document can be in any file format supported by SensusAccess for this specific workflow
format epub EPUB
epub3wmo EPUB3 with media overlay
epub3 EPUB3
mobi MOBI (Kindle)
basefontsize Normal = 0 (Optional) Predefined font sizes. If not selected the original document font size is preserved. Base font size option is only needed when EPUB and MOBI.
LARGE = 16
XLARGE = 24
HUGE = 40
DeliveryMethod Email DeliveryMethod is an optional and possible value that can be provided are Email and Download. If you do not provide the option while POSTing the job to the API, the default value Download is assumed and you need to pull the conversion result from the server and deliver it to the user. If you provide the DeliveryMethod=Email, the API will deliver the converted result to the email address which is provided in the DeliveryEmail.
Download
DeliveryEmail Your email address It is an optional field and if you provide DeliveryMethod=Email, it is mandatory to provide the email address where the service can deliver the conversion result.
UILanguage en-GB UILanguage is an optional field and it is used to pick up the email template and error messages according to the language you supplied. The supported languages at the moment are British English (en-GB), American English (en-US), Australian English (en-AU), and Danish (da-DK).
en-US
en-AU
da-DK
it-IT

Braille

Parameter name valid value Description
FileContent The input document can be in any file format supported by SensusAccess for this specific workflow
BrailleDotsFormat sixdot = 6 GET link: https://api.sensusaccess.com/job/GetBrailleDotsFormats
eightdot = 8
Language enUS enUS - English USA. Contractions: grade1 and grade2. Braille format: 6 dot.
enGB enGB - English Great Britain. Contractions: grade1 and grade2. Braille format: 6 and 8 dot.
bgBG bgBG - Bulgarian. Contraction: grade1. Braille format: 6 dot.
daDK daDK - Danish. Contractions: small, large and full. Braille format: 6 and 8 dot.
frFR frFR - French. Contraction: grade1. Braille format: 6 dot.
huHU huHU - Hungarian. Contraction: grade1. Braille format: 6 dot.
isIS isIS - Icelandic. Contraction: grade1. Braille format: 6 dot.
itIT itIT - Italian. Contraction: grade1. Braille format: 6 dot.
nbNO nbNO - Norwegian(bokmal). Contraction: level 0, 1 and 2. Braille format: 6 dot.
plPL plPL - Polish. Contraction: grade1. Braille format: 6 dot.
ptPT ptPT - Protuguese. Contraction: grade1. Braille format: 6 dot.
roRO roRO - Romanian. Contraction: grade1. Braille format: 6 dot.
slSI slSI - Slovenian. Contraction: grade1. Braille format: 6 dot.
esES esES - Spanish. Contraction: grade1. Braille format: 6 dot.
enUEB enUEB - Unified English Braille. Contraction: grade1 and grade2. Braille format: 6 dot. Output format: Unicode, Pef, NACB
GET link: https://api.sensusaccess.com/job/GetBrailleLanguages
Contraction full = 1 Supported by the language(s): daDK
small = 2 Supported by the language(s): daDK
large = 3 Supported by the language(s): daDK
grade1 = 4 Supported by the language(s): (all languages except daDK and nbNO)
grade2 = 5 Supported by the language(s): enUS, enGB
level0 = 6 Supported by the language(s): nbNO
level1 = 7 Supported by the language(s): nbNO
level2 = 8 Supported by the language(s): nbNO
GET link: api.sensusaccess.com/job/GetBrailleContractions
OutputFormat None = 0
OctoBraille = 1
Unicode = 2
Pef = 3 Pef stands for Portable Embosser Format
NACB = 4 NACB stands for North American Computer Braille
GET link: https://api.sensusaccess.com/job/GetBrailleOutputFormats
ConversionPath texttobraille = 0 (Optional) Default is texttobraille = 0
brailletotext = 1
CharactersPerLine number: 0 = no pagination and greater than (>) 10 for a valid pagination Default is 0
LinesPerPage number: 0 = no pagination and greater than (>) 2 for a valid pagination Default is 0
PageNumbering none = 0 (Optional) Default is none = 0.
right = 1
left = 2
DeliveryMethod Email DeliveryMethod is an optional and possible value that can be provided are Email and Download. If you do not provide the option while POSTing the job to the API, the default value Download is assumed and you need to pull the conversion result from the server and deliver it to the user. If you provide the DeliveryMethod=Email, the API will deliver the converted result to the email address which is provided in the DeliveryEmail.
Download
DeliveryEmail Your email address It is an optional field and if you provide DeliveryMethod=Email, it is mandatory to provide the email address where the service can deliver the conversion result.
UILanguage en-GB UILanguage is an optional field and it is used to pick up the email template and error messages according to the language you supplied. The default language is British English (en-GB) if you do not provide any. The supported languages at the moment are British English (en-GB), American English (en-US), Australian English (en-AU), and Danish (da-DK).
en-US
en-AU
da-DK
it-IT

Daisy

Parameter name Valid value Description
FileContent The input document can be in any file format supported by SensusAccess for this specific workflow
DaisyOutput TalkingBook = 1

GET link: https://api.sensusaccess.com/job/GetDaisyOutputs

Epub3WMO = 2 (deprecated: Please use the Ebook endpoint for this format)
DeliveryMethod Email DeliveryMethod is an optional and possible value that can be provided are Email and Download. If you do not provide the option while POSTing the job to the API, the default value Download is assumed and you need to pull the conversion result from the server and deliver it to the user. If you provide the DeliveryMethod=Email, the API will deliver the converted result to the email address which is provided in the DeliveryEmail.
Download
DeliveryEmail Your email address It is an optional field and if you provide DeliveryMethod=Email, it is mandatory to provide the email address where the service can deliver the conversion result.
UILanguage en-GB UILanguage is an optional field and it is used to pick up the email template and error messages according to the language you supplied. The default language is British English (en-GB) if you do not provide any. The supported languages at the moment are British English (en-GB), American English (en-US), Australian English (en-AU), and Danish (da-DK).
en-US
en-AU
da-DK
it-IT

Translation

The FileContent, SourceLanguage, TargetLanguage and SiteId are the required fields for the Translation converion type.

Parameter name Valid value Description
FileContent The input document can be in any file format supported by SensusAccess for this specific workflow
SourceLanguage ar Arabic
bg Bulgarian
ca Catalan
zh-Hans Chinese, simplified
zh-Hant Chinese traditional
hi Hindi
ja Japanese
ko Korean
cs Czech
da Danish
de German
en English
es Spanish
fi Finnish
fr French
el Greek
hu Hungarian
it Italian
nl Dutch
pl Polish
pt Portuguese
ro Romanian
ru Russian
sk Slovak
sv Swedish
no Norwegian
* Multilingual/Auto-detect

Note: If you supply * on the SourceLanguage field, the system will automatically detect the langauge of your document. This option is useful especially when your source document contains multiple languages.
TargetLanguage ar Arabic
bg Bulgarian
ca Catalan
zh-Hans Chinese, simplified
zh-Hant Chinese traditional
hi Hindi
ja Japanese
ko Korean
cs Czech
da Danish
de German
en English
es Spanish
fi Finnish
fr French
el Greek
hu Hungarian
it Italian
nl Dutch
pl Polish
pt Portuguese
ro Romanian
ru Russian
sk Slovak
sv Swedish
no Norwegian
SiteId Your SiteId assigned by Sensus. The SiteId is unique id for you assigned by Sensus for translation conversion type.
DeliveryMethod Email DeliveryMethod is an optional and possible value that can be provided are Email and Download. If you do not provide the option while POSTing the job to the API, the default value Download is assumed and you need to pull the conversion result from the server and deliver it to the user. If you provide the DeliveryMethod=Email, the API will deliver the converted result to the email address which is provided in the DeliveryEmail.
Download
DeliveryEmail Your email address It is an optional field and if you provide DeliveryMethod=Email, it is mandatory to provide the email address where the service can deliver the conversion result.
UILanguage en-GB UILanguage is an optional field and it is used to pick up the email template and error messages according to the language you supplied. The default language is British English (en-GB) if you do not provide any. The supported languages at the moment are British English (en-GB), American English (en-US), Australian English (en-AU), and Danish (da-DK).
en-US
en-AU
da-DK
it-IT

Example workflows

The following table presents some typical workflows associated with each endpoint.

Workflow Name Input Parameters Expected Output
Accessibility workflows
MS Document to text TargetDocumentFormat: OFF_TXT
FileContent: A doc/docx/rtf file
A txt file with the same name as the input file, containing only the text from the original document
MS Presentation to pdf TargetDocumentFormat: OFF_PDF
FileContent: A ppt/pptx file
A pdf file with the same name as the input file, containing only the text from the original document
html to text TargetDocumentFormat: OFF_TXT
FileContent: A html file
A txt file with the same name as the input file
image to text TargetDocumentFormat: OFF_TXT
FileContent: A png/jpg/jpeg/tiff file
A .txt file with the same name as the input file
pdf to docx TargetDocumentFormat: OFF_DOCX
FileContent: A pdf file.
A docx file with the same name as the input file
scanned pdf to tagged pdf TargetDocumentFormat: OFF_PDF
FileContent: A pdf file.
A pdf file with the same name as the input file
Mp3 workflows
text to mp3 Language: (Check valid parameters for Mp3)
SpeedOptions: (Check valid parameters for Mp3)
FileContent: A txt file
A mp3 file with the same name as the input file
HTML to mp3 Language: (Check valid parameters for Mp3)
SpeedOptions: (Check valid parameters for Mp3)
FileContent: A html file
A mp3 file with the same name as the input file
pdf/image to mp3 Language: (Check valid parameters for Mp3)
SpeedOptions: (Check valid parameters for Mp3)
FileContent: A pdf/png/jpeg/jpg/tiff file
A mp3 file with the same name as the input file
MS Document to mp3 Language: (Check valid parameters for Mp3)
SpeedOptions: (Check valid parameters for Mp3)
FileContent: A doc/docx/rtf file
A mp3 file with the same name as the input file
E-book workflows
pdf to epub2 EbookFormat: epub
FileContent: A pdf file
A epub file with the same name as the input file
image to epub2 EbookFormat: epub
FileContent: A png/jpeg/jpg/tiff file
A epub file with the same name as the input file
pdf to mobi EbookFormat: mobi
FileContent: A pdf file
A mobi file with the same name as the input file
html to epub2 EbookFormat: epub
FileContent: A html file
A epub file with the same name as the input file
docx to epub3 with media overlay (WMO) EbookFormat: Epub3WMO
FileContent: A docx file
A epub file with the same name as the input file
pdf to epub3 WMO EbookFormat: Epub3WMO
FileContent: A pdf file
A epub file with the same name as the input file
image to epub3 WMO EbookFormat: Epub3WMO
FileContent: A png/jpeg/jpg/tiff file
A epub file with the same name as the input file
Braille workflows
text to braille BrailleFormat: (Check valid parameters for Braille)
Language: (Check valid parameters for Braille)
Contraction: (Check valid parameters for Braille)
OutputFormat: None
ConversionPath: texttobraille
LinesPerPage: 0
CharactersPerLine: 0
FileContent: A txt file
PageNumbering: None
A txt file with the same name as the input file containing the desired braille format and contraction
MS Presentation to braille BrailleFormat: (Check valid parameters for Braille)
Language: (Check valid parameters for Braille)
Contraction: (Check valid parameters for Braille)
OutputFormat: None
ConversionPath: texttobraille
LinesPerPage: 0
CharactersPerLine: 0
FileContent: A ppt/pptx file
PageNumbering: None
A txt file with the same name as the input file containing the desired braille format and contraction
image to braille BrailleFormat: (Check valid parameters for Braille)
Language: (Check valid parameters for Braille)
Contraction: (Check valid parameters for Braille)
OutputFormat: None
ConversionPath: texttobraille
LinesPerPage: 0
CharactersPerLine: 0
FileContent: A png/jpg/jpeg/tiff file
PageNumbering: None
A txt file with the same name as the input file containing the desired braille format and contraction
pdf to braille BrailleFormat: (Check valid parameters for Braille)
Language: (Check valid parameters for Braille)
Contraction: (Check valid parameters for Braille)
OutputFormat: None
ConversionPath: texttobraille
LinesPerPage: 0
CharactersPerLine: 0
FileContent: A pdf file
PageNumbering: None
A txt file with the same name as the input file containing the desired braille format and contraction
docx to braille BrailleFormat: (Check valid parameters for Braille)
Language: (Check valid parameters for Braille)
Contraction: (Check valid parameters for Braille)
OutputFormat: None
ConversionPath: texttobraille
LinesPerPage: 0
CharactersPerLine: 0
FileContent: A docx file
PageNumbering: None
A txt file with the same name as the input file containing the desired braille format and contraction
html to braille BrailleFormat: (Check valid parameters for Braille)
Language: (Check valid parameters for Braille)
Contraction: (Check valid parameters for Braille)
OutputFormat: None
ConversionPath: texttobraille
LinesPerPage: 0
CharactersPerLine: 0
FileContent: A html file
PageNumbering: None
A txt file with the same name as the input file containing the desired braille format and contraction
Daisy workflows
docx to daisy talking book DaisyOutput: TalkingBook
FileContent: A docx file
A zip archive with the same name as the input file containing the daisy talking book
pdf to daisy talking book DaisyOutput: TalkingBook
FileContent: A pdf file
A zip archive with the same name as the input file containing the daisy talking book
image to daisy talking book DaisyOutput: TalkingBook
FileContent: A png/jpg/jpeg/tiff file
A zip archive with the same name as the input file containing the daisy talking book