Upload Tokens

Download Spec

List all active upload tokens

get /upload-tokens

Retrieve a list of all currently active delegated tokens.

sortBy

string

Allowed: createdAt, ttl. You can use these to sort by when a token was created, or how much longer the token will be active (ttl - time to live). Date and time is presented in ISO-8601 format.

Enum
  • createdAt
  • ttl
Example
"ttl"

sortOrder

string

Allowed: asc, desc. Ascending is 0-9 or A-Z. Descending is 9-0 or Z-A.

Enum
  • asc
  • desc
Example
"asc"

currentPage

int

Choose the number of search results to return per page. Minimum value: 1

Default
1
Example
2

pageSize

int

Results per page. Allowed values 1-100, default is 25.

Default
25
Example
30

Request

// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/UploadTokensApi.md#list

package main
import (
    "context"
    "fmt"
    "os"
    apivideosdk "github.com/apivideo/api.video-go-client"
)

func main() {
    client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
    // if you rather like to use the sandbox environment:
    // client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
        
    uploadToken := "to1tcmSFHeYY5KzyhOqVKMKb" // string | The unique identifier for the token you want information about.

    
    res, err := client.UploadTokens.GetToken(uploadToken)

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UploadTokens.GetToken``: %v\
", err)
    }
    // response from `GetToken`: UploadToken
    fmt.Fprintf(os.Stdout, "Response from `UploadTokens.GetToken`: %v\
", res)
}

Response

ExamplesSchema

Success

{
  "data": [
    {
      "token": "to37YfoPDRR2pcDKa6LsUE0M",
      "ttl": 3600,
      "createdAt": "2020-12-02T10:26:46.000Z",
      "expiresAt": "2020-12-02T11:26:46.000Z"
    },
    {
      "token": "to1W3ZS9PdUBZWzzTEZr1B79",
      "ttl": 0,
      "createdAt": "2020-12-02T10:26:28.000Z"
    }
  ],
  "pagination": {
    "currentPage": 1,
    "currentPageItems": 2,
    "pageSize": 25,
    "pagesTotal": 1,
    "itemsTotal": 2,
    "links": [
      {
        "rel": "self",
        "uri": "/upload-tokens?currentPage=1&pageSize=25"
      },
      {
        "rel": "first",
        "uri": "/upload-tokens?currentPage=1&pageSize=25"
      },
      {
        "rel": "last",
        "uri": "/upload-tokens?currentPage=1&pageSize=25"
      }
    ]
  }
}

Generate an upload token

post /upload-tokens

Generates an upload token that can be used to replace the API Key. More information can be found here

ttl

int

Time in seconds that the token will be active. A value of 0 means that the token has no exipration date. The default is to have no expiration.

Default
0
Min
0
Max
2147483647

Request

{
  "ttl": 3600
}

Response

ExamplesSchema

Success

{
  "token": "to1tcmSFHeYY5KzyhOqVKMKb",
  "ttl": 3600,
  "createdAt": "2020-12-02T10:13:19.000Z",
  "expiresAt": "2020-12-02T11:13:19.000Z"
}

Retrieve upload token

get /upload-tokens/{uploadToken}

Retrieve details about a specific upload token by id.

uploadToken

string

required

The unique identifier for the token you want information about.

Example
"to1tcmSFHeYY5KzyhOqVKMKb"

Request

// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/UploadTokensApi.md#getToken

package main

import (
    "context"
    "fmt"
    "os"
    apivideosdk "github.com/apivideo/api.video-go-client"
)

func main() {
    client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
    // if you rather like to use the sandbox environment:
    // client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
        
    uploadToken := "to1tcmSFHeYY5KzyhOqVKMKb" // string | The unique identifier for the token you want information about.

    
    res, err := client.UploadTokens.GetToken(uploadToken)

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UploadTokens.GetToken``: %v\
", err)
    }
    // response from `GetToken`: UploadToken
    fmt.Fprintf(os.Stdout, "Response from `UploadTokens.GetToken`: %v\
", res)
}

Response

ExamplesSchema

Success

{
  "token": "to1tcmSFHeYY5KzyhOqVKMKb",
  "ttl": 0,
  "createdAt": "2020-12-02T10:13:19.000Z"
}

Delete an upload token

delete /upload-tokens/{uploadToken}

Delete an existing upload token. This is especially useful for tokens you may have created that do not expire.

uploadToken

string

required

The unique identifier for the upload token you want to delete. Deleting a token will make it so the token can no longer be used for authentication.

Example
"to1tcmSFHeYY5KzyhOqVKMKb"

Request

// First install the go client with "go get github.com/apivideo/api.video-go-client"
// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/UploadTokensApi.md#deleteToken

package main

import (
    "context"
    "fmt"
    "os"
    apivideosdk "github.com/apivideo/api.video-go-client"
)

func main() {
    client := apivideosdk.ClientBuilder("YOUR_API_KEY").Build()
    // if you rather like to use the sandbox environment:
    // client := apivideosdk.SandboxClientBuilder("YOUR_SANDBOX_API_KEY").Build()
        
    uploadToken := "to1tcmSFHeYY5KzyhOqVKMKb" // string | The unique identifier for the upload token you want to delete. Deleting a token will make it so the token can no longer be used for authentication.

    
    err := client.UploadTokens.DeleteToken(uploadToken)

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UploadTokens.DeleteToken``: %v\
", err)
    }
}

Response

ExamplesSchema

No Content

Empty response

Was this page helpful?