Training Sets - Upload Data

Uploads data to the specified training set.

POST {endpoint}/customvoice/trainingsets/{id}:upload?api-version=2024-02-01-preview

URI Parameters

Name In Required Type Description
endpoint
path True

string

Supported Cognitive Services endpoints (protocol and hostname, for example: https://eastus.api.cognitive.microsoft.com).

id
path True

string

The ID of the resource.

Regex pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]{1,62}[a-zA-Z0-9]$

api-version
query True

string

The API version to use for this operation.

Request Header

Name Required Type Description
Ocp-Apim-Subscription-Key True

string

Provide your Speech resource key here.

Operation-Id

string

ID of the status monitor for the operation. If the Operation-Id header matches an existing operation and the request is not identical to the prior request, it will fail with a 400 Bad Request.

Regex pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]{1,62}[a-zA-Z0-9]$

Request Body

Name Required Type Description
audios True

AzureBlobContentSource

Azure Blob Storage content. With the examples below, it represents files https://contoso.blob.core.windows.net/voicecontainer/jessica/*.wav

kind True

DatasetKind

Dataset kind

description

string

Optional description of this dataset.

displayName

string

The name of this dataset.

scripts

AzureBlobContentSource

Azure Blob Storage content. With the examples below, it represents files https://contoso.blob.core.windows.net/voicecontainer/jessica/*.wav

Responses

Name Type Description
202 Accepted

Accepted

Headers

  • Operation-Id: string
  • Operation-Location: string
Other Status Codes

ErrorResponse

An error occurred.

Headers

x-ms-error-code: string

Security

Ocp-Apim-Subscription-Key

Provide your Speech resource key here.

Type: apiKey
In: header

Examples

Upload data to a training set

Sample request

POST {endpoint}/customvoice/trainingsets/d6916a55-2cbc-4ed4-bd19-739e9a13b0ab:upload?api-version=2024-02-01-preview



{
  "kind": "AudioAndScript",
  "audios": {
    "containerUrl": "https://contoso.blob.core.windows.net/voicecontainer?mySasToken",
    "prefix": "jessica300/",
    "extensions": [
      ".wav"
    ]
  },
  "scripts": {
    "containerUrl": "https://contoso.blob.core.windows.net/voicecontainer?mySasToken",
    "prefix": "jessica300/",
    "extensions": [
      ".txt"
    ]
  }
}

Sample response

Operation-Location: https://eastus.api.cognitive.microsoft.com/customvoice/operations/284b7e37-f42d-4054-8fa9-08523c3de345?api-version=2024-02-01-preview
Operation-Id: 284b7e37-f42d-4054-8fa9-08523c3de345

Definitions

Name Description
AzureBlobContentSource

Azure Blob Storage content. With the examples below, it represents files https://contoso.blob.core.windows.net/voicecontainer/jessica/*.wav

Dataset

Dataset object

DatasetKind

Dataset kind

Error

Top-level error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains an top-level error with error code, message, details, target and an inner error with more descriptive details.

ErrorCode

Top-level error code

ErrorResponse

Error response follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors.

InnerError

Inner error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains required properties error code, message and optional properties target, inner error(this can be nested).

AzureBlobContentSource

Azure Blob Storage content. With the examples below, it represents files https://contoso.blob.core.windows.net/voicecontainer/jessica/*.wav

Name Type Description
containerUrl

string

Azure Blob Storage container URL with SAS. Need both read and list permissions.

extensions

string[]

File name extensions.

prefix

string

Blob name prefix.

Dataset

Dataset object

Name Type Description
audios

AzureBlobContentSource

Azure Blob Storage content. With the examples below, it represents files https://contoso.blob.core.windows.net/voicecontainer/jessica/*.wav

description

string

Optional description of this dataset.

displayName

string

The name of this dataset.

kind

DatasetKind

Dataset kind

scripts

AzureBlobContentSource

Azure Blob Storage content. With the examples below, it represents files https://contoso.blob.core.windows.net/voicecontainer/jessica/*.wav

DatasetKind

Dataset kind

Name Type Description
AudioAndScript

string

AudioOnly

string

LongAudio

string

Error

Top-level error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains an top-level error with error code, message, details, target and an inner error with more descriptive details.

Name Type Description
code

ErrorCode

Top-level error code

details

Error[]

Additional supportive details regarding the error and/or expected policies.

innererror

InnerError

Inner error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains required properties error code, message and optional properties target, inner error(this can be nested).

message

string

Top-level error message.

target

string

The source of the error. For example it would be "model" or "model id" in case of invalid model.

ErrorCode

Top-level error code

Name Type Description
BadArgument

string

BadRequest

string

Forbidden

string

InternalServerError

string

NotFound

string

ServiceUnavailable

string

TooManyRequests

string

Unauthorized

string

UnsupportedMediaType

string

ErrorResponse

Error response follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors.

Name Type Description
error

Error

Top-level error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains an top-level error with error code, message, details, target and an inner error with more descriptive details.

InnerError

Inner error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains required properties error code, message and optional properties target, inner error(this can be nested).

Name Type Description
code

string

Detailed error code to help diagnostic.

innererror

InnerError

Inner error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains required properties error code, message and optional properties target, inner error(this can be nested).

message

string

Detailed error message.

target

string

The source of the error. For example it would be "model" or "model id" in case of invalid model.