Sign up for free

Webhooks

List all webhooks

Retrieve a list of all webhooks configured for the current workspace.

get /webhooks
events string

The webhook event that you wish to filter on.

Example
"video.encoding.quality.completed"
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

Requests

// 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/WebhooksApi.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()
    req := apivideosdk.WebhooksApiListRequest{}
    
    req.Events("video.encoding.quality.completed") // string | The webhook event that you wish to filter on.
    req.CurrentPage(int32(2)) // int32 | Choose the number of search results to return per page. Minimum value: 1 (default to 1)
    req.PageSize(int32(30)) // int32 | Results per page. Allowed values 1-100, default is 25. (default to 25)

    res, err := client.Webhooks.List(req)
    

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

Responses

ExamplesSchema

Success

{
  "data": [
    {
      "webhookId": "webhook_XXXXXXXXXXXXXXX",
      "createdAt": "2021-01-08T14:12:18.000Z",
      "events": [
        "video.encoding.quality.completed"
      ],
      "url": "http://clientnotificationserver.com/notif?myquery=query"
    },
    {
      "webhookId": "webhook_XXXXXXXXXYYYYYY",
      "createdAt": "2021-01-12T12:12:12.000Z",
      "events": [
        "video.encoding.quality.completed"
      ],
      "url": "http://clientnotificationserver.com/notif?myquery=query2"
    }
  ],
  "pagination": {
    "currentPage": 1,
    "pageSize": 25,
    "pagesTotal": 1,
    "itemsTotal": 11,
    "currentPageItems": 11,
    "links": [
      {
        "rel": "self",
        "uri": "https://ws.api.video/webhooks?currentPage=1"
      },
      {
        "rel": "first",
        "uri": "https://ws.api.video/webhooks?currentPage=1"
      },
      {
        "rel": "last",
        "uri": "https://ws.api.video/webhooks?currentPage=1"
      }
    ]
  }
}

Create Webhook

Webhooks can push notifications to your server, rather than polling api.video for changes. We currently offer four events:

  • video.encoding.quality.completed Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like { "type": "video.encoding.quality.completed", "emittedAt": "2021-01-29T16:46:25.217+01:00", "videoId": "viXXXXXXXX", "encoding": "hls", "quality": "720p"} . This request says that the 720p HLS encoding was completed.
  • live-stream.broadcast.started When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires.
  • live-stream.broadcast.ended This event fires when a live stream has finished broadcasting.
  • video.source.recorded This event occurs when a live stream is recorded and submitted for encoding.
post /webhooks
events array[string]

required

A list of the webhooks that you are subscribing to. There are Currently four webhook options:

  • video.encoding.quality.completed Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like { \"type\": \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\", \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"} . This request says that the 720p HLS encoding was completed.
  • live-stream.broadcast.started When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires.
  • live-stream.broadcast.ended This event fires when a live stream has finished broadcasting.
  • video.source.recorded Occurs when a live stream is recorded and submitted for encoding.
Example
[ "video.encoding.quality.completed" ]
url string

required

The the url to which HTTP notifications are sent. It could be any http or https URL.

Example
"https://example.com/webhooks"

Requests

{
  "events": [
    "video.encoding.quality.completed"
  ],
  "url": "http://clientnotificationserver.com/notif?myquery=query"
}

Responses

ExamplesSchema

Created

{
  "webhookId": "webhook_XXXXXXXXXXXXXXX",
  "createdAt": "2021-01-08T14:12:18.000Z",
  "events": [
    "video.encoding.quality.completed"
  ],
  "url": "http://clientnotificationserver.com/notif?myquery=query"
}

Retrieve Webhook details

Retrieve webhook details by id.

get /webhooks/{webhookId}
webhookId string

required

The unique webhook you wish to retreive details on.

Requests

// 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/WebhooksApi.md#get

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()
        
    webhookId := "webhookId_example" // string | The unique webhook you wish to retreive details on.

    
    res, err := client.Webhooks.Get(webhookId)

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

Responses

ExamplesSchema

Success

{
  "webhookId": "webhook_XXXXXXXXXXXXXXX",
  "createdAt": "2021-01-08T14:12:18.000Z",
  "events": [
    "video.encoding.quality.completed"
  ],
  "url": "http://clientnotificationserver.com/notif?myquery=query"
}

Delete a Webhook

This endpoint will delete the indicated webhook.

delete /webhooks/{webhookId}
webhookId string

required

The webhook you wish to delete.

Requests

// 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/WebhooksApi.md#delete

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()
        
    webhookId := "webhookId_example" // string | The webhook you wish to delete.

    
    err := client.Webhooks.Delete(webhookId)

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

Responses

ExamplesSchema

No Content

Empty response

Was this page helpful?