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

# Get TUS' parameters for direct upload

> Use this method to get TUS' session parameters: hostname of the server to upload, secure token.

The general sequence of actions for a direct upload of a video is as follows:
- Create video entity via POST method ["Create video"](/docs/api-reference/streaming/videos/create-video)
- Get TUS' session parameters (you are here now)
- Upload file via TUS client, choose your implementation on [tus.io](https://tus.io/implementations) 

Final endpoint for uploading is constructed using the following template: "https://{hostname}/upload/". Also you have to provide token, `client_id`, `video_id` as metadata too. 

A short javascript example is shown below, based on tus-js-client. Variable "data" below is the result of this API request. Please, note that we support 2.x version only of tus-js-client.

```
    uploads[data.video.id] = new tus.Upload(file, {
      endpoint: `https://${data.servers[0].hostname}/upload/`,
      metadata: {
        filename: data.video.name,
        token: data.token,
        video_id: data.video.id,
        client_id: data.video.client_id
      },
      onSuccess: function() {
        ...
      }
    }
    uploads[data.video.id].start();
  ```



## OpenAPI

````yaml /api-reference/services_documented/streaming_api.yaml get /streaming/videos/{video_id}/upload
openapi: 3.1.0
info:
  title: Gcore OpenAPI – Streaming API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: '2026-05-15T06:37:28.230198+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: AI
    x-displayName: AI
  - name: Broadcasts
    x-displayName: Broadcasts
  - name: Directories
    x-displayName: Directories
  - name: Overlays
    x-displayName: Overlays
  - name: Players
    x-displayName: Players
  - name: Playlists
    x-displayName: Playlists
  - name: QualitySets
    x-displayName: QualitySets
  - name: Restreams
    x-displayName: Restreams
  - name: Streaming Statistics
    x-displayName: Statistics
  - name: Streams
    x-displayName: Streams
  - name: Subtitles
    x-displayName: Subtitles
  - name: Videos
    x-displayName: Videos
paths:
  /streaming/videos/{video_id}/upload:
    get:
      tags:
        - Videos
      summary: Get TUS' parameters for direct upload
      description: >-
        Use this method to get TUS' session parameters: hostname of the server
        to upload, secure token.


        The general sequence of actions for a direct upload of a video is as
        follows:

        - Create video entity via POST method ["Create
        video"](/docs/api-reference/streaming/videos/create-video)

        - Get TUS' session parameters (you are here now)

        - Upload file via TUS client, choose your implementation on
        [tus.io](https://tus.io/implementations) 


        Final endpoint for uploading is constructed using the following
        template: "https://{hostname}/upload/". Also you have to provide token,
        `client_id`, `video_id` as metadata too. 


        A short javascript example is shown below, based on tus-js-client.
        Variable "data" below is the result of this API request. Please, note
        that we support 2.x version only of tus-js-client.


        ```
            uploads[data.video.id] = new tus.Upload(file, {
              endpoint: `https://${data.servers[0].hostname}/upload/`,
              metadata: {
                filename: data.video.name,
                token: data.token,
                video_id: data.video.id,
                client_id: data.video.client_id
              },
              onSuccess: function() {
                ...
              }
            }
            uploads[data.video.id].start();
          ```
      operationId: get_api_videos_id_upload
      parameters:
        - name: video_id
          in: path
          description: |-
            Video ID.   
            IDs of all created videos can be received via Get All Videos request
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getUrlAndTokenToUploadVideo'
      x-codeSamples:
        - lang: Python
          source: >-
            import os

            from gcore import Gcore


            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )

            direct_upload_parameters =
            client.streaming.videos.get_parameters_for_direct_upload(
                0,
            )

            print(direct_upload_parameters.video)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/option\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tdirectUploadParameters, err := client.Streaming.Videos.GetParametersForDirectUpload(context.TODO(), 0)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", directUploadParameters.Video)\n}\n"
components:
  schemas:
    getUrlAndTokenToUploadVideo:
      type: object
      properties:
        servers:
          type: array
          description: >-
            An array which contains information about servers you can upload a
            video to.   
             **Server;** type — object.   
             

            ---

             Server has the following fields:   

            - **id;** type — integer  
               Server ID
              
            - **hostname;** type — string  
               Server hostname
          items:
            type: object
            properties: {}
        token:
          type: string
          description: Token
        video:
          type: object
          properties: {}
          description: >-
            Contains information about the created video. See the full
            description in the Get video request
      example:
        servers:
          - id: 15
            hostname: example.com
        token: X2lkIjoxMDE1fSwi
        video:
          id: 17
          name: Video
          description: Conference July
          client_id: 100
          duration: 4120
          slug: zInSg1FL80
          origin_size: 2974741
          origin_host: origin.host.org
          origin_resource: ''
          origin_height: 1080
          screenshots:
            - https://screenshot1.example.com/494.jpg
          screenshot_id: 0
          ad_id: 2
          projection: regular
          client_user_id: 10
          hls_url: https://example.com/master.m3u8
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````