Authentication and refresh tokens

With, every call to the API requires authentication. We use Bearer authentication for everything, so on your first request, you send your API key in an authorization header and get back an access token and a refresh token. The access token lasts for one hour. The refresh token lasts until you make a new call to the API to get an access token, or you send in your API key again to get an access token and refresh token.

Bearer authentication is simple to set up and use; however, we encourage you to use one of our clients if possible. clients handle authentication for you, including renewing your token as needed. This guide will show you how to quickly install the client of your choice and provide the code snippet you'll need for authentication.



We will show the corresponding cURL commands for each part of the tutorial when appropriate.

Associated API reference documentation


We offer blog content on this topic:

Choose an client

The clients offered by include:


To install your selected client, do the following:

go get
composer require api-video/php-api-client
npm install --save

...or with yarn: 
yarn add
pip install
Using Nuget
Install-Package ApiVideo

Retrieve your API key

You'll need your API key to get started. You can sign up for one here: Get your API key!. Then do the following:

  1. Log in to the dashboard.
  2. From the list of choices on the left, make sure you are on API Keys
  3. You will always be able to choose to use your Sandbox API key. If you want to use the Production API key instead, enter your credit card information.
  4. Grab the key you want, and you're ready to get started!


For each client, you will set up a client and provide it with your API key. The client then takes care of everything else for you. It will keep track of your access token and refresh token. When the access token expires after an hour, it will renew when needed.

curl -X POST \ \
-H 'Content-Type: application/json' \
-d '{"apiKey": "your API key here"}'
package main

import (
    apivideosdk ""

func main() {
    client := apivideosdk.ClientBuilder("YOUR_API_TOKEN").Build()
    // if you rather like to use the sandbox environment:
    // client := apivideosdk.SandboxClientBuilder("YOU_SANDBOX_API_TOKEN").Build()
    authenticatePayload := *apivideosdk.NewAuthenticatePayload("ApiKey_example") // AuthenticatePayload | 

    res, err := client.Authentication.Authenticate(authenticatePayload)

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `Authentication.Authenticate``: %v\n", err)
    // response from `Authenticate`: AccessToken
    fmt.Fprintf(os.Stdout, "Response from `Authentication.Authenticate`: %v\n", res)
require __DIR__ .'/vendor/autoload.php';

use Symfony\Component\HttpClient\Psr18Client;
use ApiVideo\Client\Client;
use ApiVideo\Client\Model\VideoCreationPayload;

$apiKey = 'your API key here';
$apiVideoEndpoint = '';

$httpClient = new \Symfony\Component\HttpClient\Psr18Client();
$client = new ApiVideo\Client\Client(

/* Your refresh token is handled for you */
const ApiVideoClient = require('');

(async () => {
    try {
        const client = new ApiVideoClient({ apiKey: "YOUR_API_TOKEN" });
# Use your api key to retrieve an access token for use with the
# API. Access tokens are good for one hour.

import apivideo

api_key = "your api key here"
client = apivideo.AuthenticatedApiClient(api_key)

# If you prefer to use the sandbox environment:
# client = apivideo.AuthenticatedApiClient(api_key, production=False)


# You can view the object like this. Use this for reference and testing only.

using System.Collections.Generic;
using System.Diagnostics;
using System;
using System.IO;
using ApiVideo.Api;
using ApiVideo.Client;
using ApiVideo.Model;

namespace Example
    public class Example
        public static void Main()
            var apiKey = "YOUR_API_KEY";

            var apiVideoClient = new ApiVideoClient(apiKey);
            // if you rather like to use the sandbox environment:
            // var apiVideoClient = new ApiVideoClient(apiKey, ApiVideo.Client.Environment.SANDBOX);


Authentication is required for every call to It's made easy with clients, so we recommend choosing a client to work with.

Did this page help you?