> ## Documentation Index
> Fetch the complete documentation index at: https://docs.livepeer.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload an asset

> Learn how to upload and play back an asset

Uploading and watching an asset is easy! The example below uses the
[Create Asset API](/api-reference/asset/upload) to create an upload URL to
upload a video.

<Info>
  Livepeer supports resumable uploads through the TUS protocol, which helps with
  reliability and efficiency when transferring large assets. **This is the
  recommended approach for uploading media files.**
</Info>

Livepeer provides two options for uploading assets:

* **TUS Resumable Upload (recommended for all use-cases)**: TUS uploads ensure
  reliability and efficiency when transferring media files. It is recommended
  for all use-cases, as it is compatible with all modern browsers and supports
  resuming uploads.
* **`PUT` Upload**: Upload assets via simple HTTP verbs for processing and play
  back.

## Using Livepeer's SDKs

We can use one of the Livepeer SDKs to create a
[TUS-compatible](https://github.com/TUS/TUS-js-client) upload endpoint.

We can then use TUS on the frontend to directly upload the asset to Livepeer.

<Tabs>
  <Tab title="Node.js">
    ```javascript theme={"theme":{"light":"github-light","dark":"dark-plus"}}
    import { Livepeer } from "livepeer";

    const apiKey = 'YOUR_API_KEY';
    const fileName = 'filename.mp4';

    const livepeer = new Livepeer({apiKey});

    const assetData = {
      name: fileName
    };

    livepeer
      .asset.create(assetData)
      .then((response) => {
        console.log("Asset upload request:", response);
      })
      .catch((error) => {
        console.error("Error requesting asset upload:", error);
      });

    // pass the TUS endpoint to the frontend and use TUS to upload
    // https://github.com/TUS/TUS-js-client
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={"theme":{"light":"github-light","dark":"dark-plus"}}
    from livepeer import Livepeer

    # Initialize the Livepeer client with your API key
    api_key = "YOUR_API_KEY"
    livepeer = Livepeer(api_key)

    file_name = "filename.mp4"  # Replace with the desired file name

    asset_data = {
        "name": file_name
    }

    try:
        # Request asset upload
        response = livepeer.asset.create(asset_data)
        print("Asset upload request:", response)
    except Exception as e:
        print("Error requesting asset upload:", e)

    # pass the TUS endpoint to the frontend and use TUS to upload
    # https://github.com/TUS/TUS-js-client
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={"theme":{"light":"github-light","dark":"dark-plus"}}
      package main

      import(
        livepeergo "github.com/livepeer/livepeer-go"
        "github.com/livepeer/livepeer-go/models/components"
        "context"
        "log"
      )

      func main() {
        // Initialize the Livepeer client with your API key
          client := livepeergo.New(
              livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
          )
          request := components.NewAssetPayload{
              Name: "filename.mp4", // Replace with the desired file name
          }
          ctx := context.Background()
          res, err := client.Asset.Create(ctx, request)
          if err != nil {
              log.Fatal(err)
          }
          if res.Data != nil {
              // handle response
          }
    // pass the TUS endpoint to the frontend and use TUS to upload
    // https://github.com/TUS/TUS-js-client
    ```
  </Tab>
</Tabs>

Once an upload endpoint is created, you can use it to upload your video file to
Livepeer. The upload endpoint is TUS compatible, so you can use any
TUS-compatible client (like
[TUS-js-client](https://github.com/TUS/TUS-js-client)) to upload your video file
from the frontend.

<Info>
  **For rapid processing of assets that will also be archived on IPFS or
  Arweave, we strongly encourage either (1) uploading to Livepeer with the [IPFS
  storage option
  enabled](/developers/tutorials/upload-playback-videos-on-ipfs#uploading-videos-to-ipfs),
  or (2) uploading the raw file to the API prior to archiving on dStorage,
  rather than passing the IPFS / Arweave gateway URL. The gateway URL will work,
  but may incur longer-than-usual processing time.**
</Info>

### IPFS and Arweave sources

<Info>
  IPFS is a network of nodes that allow you to read content from the network
  using a content identifier unique to the data you’re requesting, ensuring you
  are able to verifiably get exactly what you are asking for, regardless of
  where the data is physically stored. Arweave is a set of nodes that are
  incentivized to store data permanently; content stored on the network is
  pulled through an Arweave gateway.
</Info>

### Play an asset

To learn how to play an asset, see the
[Play an Asset](/developers/guides/playback-an-asset) guide.
