Skip to content

POST /jobs/templates ​

Description ​

Create a new template to save and reuse certain preconfigured job settings.

Authentication ​

  • Required: Yes
  • Method: Bearer token

Request Headers ​

  • Authorization: Bearer [AUTH_TOKEN]
  • Content-Type: application/json

Parameters ​

Query Parameters ​

  • format: string (Optional)
    Values: json, xml
    Overrides the Request Accept header.
  • human: boolean (Optional)
    Values: true, false
    If set to true, the response will be in a structured, more human-readable form. Useful when calling the API through curl or a browser.
  • show_null: boolean (Optional)
    Values: true, false
    If set to true, the response will contain also keys that are not set to a value.
  • expand_all: boolean (Optional)
    Values: true, false
    Recursively look up referenced objects (e.g. preset id) and embed the respective JSON as a nested object directly into the response.

Body Parameters ​

  • template: object (Required)
    • name: string (Required)
      Name of the new template.
    • description: string (Optional)
      A longer description about the purpose of the template.
    • job_settings: object (Required)
      The actual job settings to be stored as a template. The schema matches that of the Jobs resource with the exception that the input.input_name and unique_custom_key keys are not valid and cannot be set for a template.

Example Request ​

bash
curl -X POST "https://api.xvid.com/v1/jobs/templates/?human=true" \
  -H "Authorization: Bearer AUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "template": {
    "name": "My Test Template",
    "job_settings": {
      "input": {
        "start_time": 0
      },
      "autograph": {
        "watermark_strength": "light"
      },
      "user_data": "My Personal Marker",
      "output_prefix": "{job_id}/",
      "outputs": [
        {
          "output_name": "{input_name}",
          "thumbnails": [
            {
              "thumbnail_names": "thumb_{resolution}",
              "thumbnail_preset": "thumbnails_small"
            }
          ],
          "logos": [
            {
              "logo_image": "https://s3-us-east-1.amazonaws.com/my_logo_pngs/logo30.png",
              "logo_preset": "logo_30_bottom_right"
            }
          ],
          "settings": {
            "video": {
              "height": "100%",
              "width": "100%",
              "bitrate": "90%"
            }
          },
          "preset": {
            "id": "5e2834a2c35f386a1327c958"
          }
        }
      ],
      "pipeline": {
        "id": "5eb43241e4b0463cfe034c1f"
      }
    }
  }
}'

Example Response ​

Success (201 Created) ​

json
{
  "template": {
    "id": "6476055c7761b534f5b20581",
    "name": "My Test Template",
    "job_settings": {
      "pipeline": {
        "id": "5eb43241e4b0463cfe034c1f",
        "href": "https://api.xvid.com/v1/pipelines/5eb43241e4b0463cfe034c1f"
      },
      "input": {
        "start_time": 0
      },
      "autograph": {
        "watermark_strength": "light"
      },
      "user_data": "My Personal Marker",
      "output_prefix": "{job_id}/",
      "outputs": [
        {
          "output_name": "{input_name}",
          "thumbnails": [
            {
              "thumbnail_names": "thumb_{resolution}",
              "thumbnail_preset": "thumbnails_small"
            }
          ],
          "logos": [
            {
              "logo_image": "https://s3-us-east-1.amazonaws.com/my_logo_pngs/logo30.png",
              "logo_preset": "logo_30_bottom_right"
            }
          ],
          "settings": {
            "video": {
              "height": "100%",
              "width": "100%",
              "bitrate": "90%"
            }
          },
          "preset": {
            "id": "5e2834a2c35f386a1327c958",
            "href": "https://api.xvid.com/v1/presets/5e2834a2c35f386a1327c958"
          }
        }
      ]
    },
    "created_at": 1685456220714,
    "updated_at": 1685456220714,
    "href": "https://api.xvid.com/v1/jobs/templates/6476055c7761b534f5b20581"
  }
}

Error Responses ​

400 Bad Request ​

json
{
  "error": {
    "error_code": "0x0400002",
    "error_message": "Template is invalid"
  }
}

403 Unauthorized ​

json
{
  "error": {
    "error_code": "0x0000003",
    "error_message": "Invalid access token"
  }
}

500 Internal Server Error ​

json
{
  "error": {
    "error_code": "0x0000001",
    "error_message": "Internal server error"
  }
}