.NET quickstart
This guide walks you through using Hume’s Expression Measurement API with the .NET SDK. You will submit a batch job to analyze a media file and then connect to the streaming API for real-time predictions.
Setup
Install the SDK
Set your API key
Get your API key from the Hume AI platform and set it as an environment variable.
Create the client
Batch API
The Batch API lets you submit files for processing and retrieve predictions when the job completes. This is best for analyzing recordings, datasets, and other pre-recorded content.
Submit a job
Start a job by specifying the models you want to run and the URLs of the files to process.
You can also upload local files instead of URLs. See the API reference for the local file upload endpoint.
Wait for the job to complete
Poll the job status until it reaches COMPLETED or FAILED.
For production use, consider passing a CallbackUrl when submitting the job. Hume will send a POST request to your
URL when the job completes, eliminating the need to poll. The webhook payload includes the job_id, status, and
predictions.
Retrieve predictions
Once the job completes, retrieve and print the predictions.
Predictions are also available as CSV files. Use the Get job artifacts endpoint to download a zip archive containing one CSV per model.
Streaming API
The Streaming API provides real-time predictions over a WebSocket connection. This is best for live audio, video, and interactive applications.
Connect and send data
Create a streaming connection and send text for analysis.
Stream a file
You can also send audio or video files through the streaming connection by encoding them as base64.

