# Get Started This short tutorial will teach you the basics of using the Forced Alignment API. It demonstrates how to obtain precise word timings for the words in a speech-to-text transcript. ## Assumptions This tutorial assumes that you have a Rev AI account. If not, [sign up for a free account](https://www.rev.ai/auth/signup). ## Step 1: Get your access token If you haven't already done so, obtain a Rev AI API access token: The first step is to generate an access token, which will enable access to the Rev AI APIs. Follow these steps: 1. [Log in](https://www.rev.ai/auth/login) to Rev AI. 2. Navigate to the [**Access Token** page](https://www.rev.ai/access-token). 3. Click the **Generate New Access Token** link. Confirm the operation in the pop-up dialog box. ![Creating an access token](/images/create-token.png) The new access token will be generated and displayed on the screen. Save your access tokens somewhere safe; you will only be able to see them once. You are allowed a maximum of 2 access tokens at a time. ## Step 2: Submit an audio file and transcript for forced alignment Submit an audio file and transcript text file (i.e. a file containing only the words of a transcript) for forced alignment to Rev AI using the command below. Replace the `` placeholder with the access token obtained in Step 1, and replace the sample file URLs shown below with the URLs to your own audio and transcript files. ```bash curl -X POST "https://api.rev.ai/alignment/v1/jobs" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"source_config": {"url": "https://www.rev.ai/FTC_Sample_1.mp3"}, "source_transcript_config": {"url": "https://your-bucket.s3.us-west-2.amazonaws.com/transcript.txt"}, "metadata":"This is a forced alignment test"}' ``` You'll receive a response like this: ```bash { "id": "Umx5c6F7pH7r", "created_on": "2023-06-12T15:54:20.406Z", "metadata": "This is a forced alignment test", "status": "in_progress", "type": "alignment" } ``` The `id` (in this case `Umx5c6F7pH7r`) will enable you to retrieve your forced alignment result. ## Step 3: Retrieve the forced alignment results You now need to wait for the job to complete. Wait for approximately 30 seconds and then check the `status` of your job by querying the API as shown below: ```bash curl -X GET https://api.rev.ai/alignment/v1/jobs/ \ -H "Authorization: Bearer " ``` Polling the API periodically for job status is NOT recommended in a production server. Rather, use [webhooks](/api/alignment/webhooks) to asynchronously receive notifications once the forced alignment job completes. Once the job's `status` changes to `completed`, you can retrieve the transcript with word timings in JSON format by running the command below. As before, replace the `` placeholder with the access token obtained in [Step 1](#step-1-get-your-access-token). You must also replace the `` placeholder with the `id` obtained in [Step 2](#step-2-submit-an-audio-file-and-transcript-for-forced-alignment). ```bash curl -X GET "https://api.rev.ai/alignment/v1/jobs//transcript" \ -H "Authorization: Bearer " \ -H "Accept: application/vnd.rev.transcript.v1.0+json" ``` Here is a truncated example of the output: ```javascript { "monologues":[ { "speaker":0, "elements":[ { "type":"text","value":"hi","ts":0.24,"end_ts":0.48 }, { "type":"text","value":"my","ts":0.54,"end_ts":0.66 }, { "type":"text","value":"name's","ts":0.66,"end_ts":0.87 } ] } ] } ``` ## Next steps You should now have a basic idea of how to use the Forced Alignment API. To learn more, read [the API documentation](/api/alignment) for complete details on the different resources and operations available in this API. You can also read about our [other APIs](/api) and find [code samples and SDK documentation](/sdk) that will help you connect your application with the API.