openapi: 3.0.0
servers:
  - url: https://texttospeech.googleapis.com/
info:
  contact:
    name: Google
    url: https://google.com
    x-twitter: youtube
  description: Synthesizes natural-sounding speech by applying powerful neural network models.
  license:
    name: Creative Commons Attribution 3.0
    url: http://creativecommons.org/licenses/by/3.0/
  termsOfService: https://developers.google.com/terms/
  title: Cloud Text-to-Speech API
  version: v1
  x-apiClientRegistration:
    url: https://console.developers.google.com
  x-apisguru-categories:
    - analytics
    - media
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_www.google.com_images_branding_googlelogo_2x_googlelogo_color_272x92dp.png
  x-origin:
    - format: openapi
      url: https://texttospeech.googleapis.com/$discovery/rest?version=v1
      version: "3.0"
  x-preferred: false
  x-providerName: googleapis.com
  x-serviceName: texttospeech
externalDocs:
  url: https://cloud.google.com/text-to-speech/
tags:
  - name: operations
  - name: projects
  - name: text
  - name: voices
paths:
  /v1/text:synthesize:
    parameters:
      - $ref: "#/components/parameters/_.xgafv"
      - $ref: "#/components/parameters/access_token"
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/callback"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/upload_protocol"
      - $ref: "#/components/parameters/uploadType"
    post:
      description: "Synthesizes speech synchronously: receive results after all text input has been processed."
      operationId: texttospeech.text.synthesize
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SynthesizeSpeechRequest"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SynthesizeSpeechResponse"
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/cloud-platform
          Oauth2c:
            - https://www.googleapis.com/auth/cloud-platform
      tags:
        - text
  /v1/voices:
    get:
      description: Returns a list of Voice supported for synthesis.
      operationId: texttospeech.voices.list
      parameters:
        - description: Optional. Recommended. [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If not specified, the API will return all supported voices. If specified, the ListVoices call will only return voices that can be used to synthesize this language_code. For example, if you specify `"en-NZ"`, all `"en-NZ"` voices will be returned. If you specify `"no"`, both `"no-\*"` (Norwegian) and `"nb-\*"` (Norwegian Bokmal) voices will be returned.
          in: query
          name: languageCode
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListVoicesResponse"
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/cloud-platform
          Oauth2c:
            - https://www.googleapis.com/auth/cloud-platform
      tags:
        - voices
    parameters:
      - $ref: "#/components/parameters/_.xgafv"
      - $ref: "#/components/parameters/access_token"
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/callback"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/upload_protocol"
      - $ref: "#/components/parameters/uploadType"
  "/v1/{name}":
    delete:
      description: Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
      operationId: texttospeech.operations.delete
      parameters:
        - description: The name of the operation resource to be deleted.
          in: path
          name: name
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Empty"
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/cloud-platform
          Oauth2c:
            - https://www.googleapis.com/auth/cloud-platform
      tags:
        - operations
    get:
      description: Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
      operationId: texttospeech.projects.locations.operations.get
      parameters:
        - description: The name of the operation resource.
          in: path
          name: name
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Operation"
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/cloud-platform
          Oauth2c:
            - https://www.googleapis.com/auth/cloud-platform
      tags:
        - projects
    parameters:
      - $ref: "#/components/parameters/_.xgafv"
      - $ref: "#/components/parameters/access_token"
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/callback"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/upload_protocol"
      - $ref: "#/components/parameters/uploadType"
  "/v1/{name}/operations":
    get:
      description: Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
      operationId: texttospeech.projects.locations.operations.list
      parameters:
        - description: The name of the operation's parent resource.
          in: path
          name: name
          required: true
          schema:
            type: string
        - description: The standard list filter.
          in: query
          name: filter
          schema:
            type: string
        - description: The standard list page size.
          in: query
          name: pageSize
          schema:
            type: integer
        - description: The standard list page token.
          in: query
          name: pageToken
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListOperationsResponse"
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/cloud-platform
          Oauth2c:
            - https://www.googleapis.com/auth/cloud-platform
      tags:
        - projects
    parameters:
      - $ref: "#/components/parameters/_.xgafv"
      - $ref: "#/components/parameters/access_token"
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/callback"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/upload_protocol"
      - $ref: "#/components/parameters/uploadType"
  "/v1/{name}:cancel":
    parameters:
      - $ref: "#/components/parameters/_.xgafv"
      - $ref: "#/components/parameters/access_token"
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/callback"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/upload_protocol"
      - $ref: "#/components/parameters/uploadType"
    post:
      description: Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
      operationId: texttospeech.operations.cancel
      parameters:
        - description: The name of the operation resource to be cancelled.
          in: path
          name: name
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CancelOperationRequest"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Empty"
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/cloud-platform
          Oauth2c:
            - https://www.googleapis.com/auth/cloud-platform
      tags:
        - operations
  "/v1/{parent}:synthesizeLongAudio":
    parameters:
      - $ref: "#/components/parameters/_.xgafv"
      - $ref: "#/components/parameters/access_token"
      - $ref: "#/components/parameters/alt"
      - $ref: "#/components/parameters/callback"
      - $ref: "#/components/parameters/fields"
      - $ref: "#/components/parameters/key"
      - $ref: "#/components/parameters/oauth_token"
      - $ref: "#/components/parameters/prettyPrint"
      - $ref: "#/components/parameters/quotaUser"
      - $ref: "#/components/parameters/upload_protocol"
      - $ref: "#/components/parameters/uploadType"
    post:
      description: Synthesizes long form text asynchronously.
      operationId: texttospeech.projects.locations.synthesizeLongAudio
      parameters:
        - description: The resource states of the request in the form of `projects/*/locations/*`.
          in: path
          name: parent
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SynthesizeLongAudioRequest"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Operation"
          description: Successful response
      security:
        - Oauth2:
            - https://www.googleapis.com/auth/cloud-platform
          Oauth2c:
            - https://www.googleapis.com/auth/cloud-platform
      tags:
        - projects
components:
  parameters:
    _.xgafv:
      description: V1 error format.
      in: query
      name: $.xgafv
      schema:
        enum:
          - "1"
          - "2"
        type: string
    access_token:
      description: OAuth access token.
      in: query
      name: access_token
      schema:
        type: string
    alt:
      description: Data format for response.
      in: query
      name: alt
      schema:
        enum:
          - json
          - media
          - proto
        type: string
    callback:
      description: JSONP
      in: query
      name: callback
      schema:
        type: string
    fields:
      description: Selector specifying which fields to include in a partial response.
      in: query
      name: fields
      schema:
        type: string
    key:
      description: API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      in: query
      name: key
      schema:
        type: string
    oauth_token:
      description: OAuth 2.0 token for the current user.
      in: query
      name: oauth_token
      schema:
        type: string
    prettyPrint:
      description: Returns response with indentations and line breaks.
      in: query
      name: prettyPrint
      schema:
        type: boolean
    quotaUser:
      description: Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
      in: query
      name: quotaUser
      schema:
        type: string
    uploadType:
      description: Legacy upload protocol for media (e.g. "media", "multipart").
      in: query
      name: uploadType
      schema:
        type: string
    upload_protocol:
      description: Upload protocol for media (e.g. "raw", "multipart").
      in: query
      name: upload_protocol
      schema:
        type: string
  schemas:
    AudioConfig:
      description: Description of audio data to be synthesized.
      properties:
        audioEncoding:
          description: Required. The format of the audio byte stream.
          enum:
            - AUDIO_ENCODING_UNSPECIFIED
            - LINEAR16
            - MP3
            - OGG_OPUS
            - MULAW
            - ALAW
          type: string
        effectsProfileId:
          description: Optional. Input only. An identifier which selects 'audio effects' profiles that are applied on (post synthesized) text to speech. Effects are applied on top of each other in the order they are given. See [audio profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for current supported profile ids.
          items:
            type: string
          type: array
        pitch:
          description: Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 semitones from the original pitch. -20 means decrease 20 semitones from the original pitch.
          format: double
          type: number
        sampleRateHertz:
          description: Optional. The synthesis sample rate (in hertz) for this audio. When this is specified in SynthesizeSpeechRequest, if this is different from the voice's natural sample rate, then the synthesizer will honor this request by converting to the desired sample rate (which might result in worse audio quality), unless the specified sample rate is not supported for the encoding chosen, in which case it will fail the request and return google.rpc.Code.INVALID_ARGUMENT.
          format: int32
          type: integer
        speakingRate:
          description: Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal native speed supported by the specific voice. 2.0 is twice as fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any other values < 0.25 or > 4.0 will return an error.
          format: double
          type: number
        volumeGainDb:
          description: Optional. Input only. Volume gain (in dB) of the normal native volume supported by the specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) will play at approximately half the amplitude of the normal native signal amplitude. A value of +6.0 (dB) will play at approximately twice the amplitude of the normal native signal amplitude. Strongly recommend not to exceed +10 (dB) as there's usually no effective increase in loudness for any value greater than that.
          format: double
          type: number
      type: object
    CancelOperationRequest:
      description: The request message for Operations.CancelOperation.
      properties: {}
      type: object
    CustomVoiceParams:
      description: Description of the custom voice to be synthesized.
      properties:
        model:
          description: Required. The name of the AutoML model that synthesizes the custom voice.
          type: string
        reportedUsage:
          description: Optional. The usage of the synthesized audio to be reported.
          enum:
            - REPORTED_USAGE_UNSPECIFIED
            - REALTIME
            - OFFLINE
          type: string
      type: object
    Empty:
      description: "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }"
      properties: {}
      type: object
    GoogleCloudTexttospeechV1SynthesizeLongAudioMetadata:
      description: Metadata for response returned by the `SynthesizeLongAudio` method.
      properties:
        progressPercentage:
          description: The progress of the most recent processing update in percentage, ie. 70.0%.
          format: double
          type: number
        startTime:
          description: Time when the request was received.
          format: google-datetime
          type: string
      type: object
    ListOperationsResponse:
      description: The response message for Operations.ListOperations.
      properties:
        nextPageToken:
          description: The standard List next-page token.
          type: string
        operations:
          description: A list of operations that matches the specified filter in the request.
          items:
            $ref: "#/components/schemas/Operation"
          type: array
      type: object
    ListVoicesResponse:
      description: The message returned to the client by the `ListVoices` method.
      properties:
        voices:
          description: The list of voices.
          items:
            $ref: "#/components/schemas/Voice"
          type: array
      type: object
    Operation:
      description: This resource represents a long-running operation that is the result of a network API call.
      properties:
        done:
          description: If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
          type: boolean
        error:
          $ref: "#/components/schemas/Status"
          description: The error result of the operation in case of failure or cancellation.
        metadata:
          additionalProperties:
            description: Properties of the object. Contains field @type with type URL.
          description: Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
          type: object
        name:
          description: The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
          type: string
        response:
          additionalProperties:
            description: Properties of the object. Contains field @type with type URL.
          description: The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
          type: object
      type: object
    Status:
      description: "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors)."
      properties:
        code:
          description: The status code, which should be an enum value of google.rpc.Code.
          format: int32
          type: integer
        details:
          description: A list of messages that carry the error details. There is a common set of message types for APIs to use.
          items:
            additionalProperties:
              description: Properties of the object. Contains field @type with type URL.
            type: object
          type: array
        message:
          description: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
          type: string
      type: object
    SynthesisInput:
      description: Contains text input to be synthesized. Either `text` or `ssml` must be supplied. Supplying both or neither returns google.rpc.Code.INVALID_ARGUMENT. The input size is limited to 5000 bytes.
      properties:
        ssml:
          description: The SSML document to be synthesized. The SSML document must be valid and well-formed. Otherwise the RPC will fail and return google.rpc.Code.INVALID_ARGUMENT. For more information, see [SSML](https://cloud.google.com/text-to-speech/docs/ssml).
          type: string
        text:
          description: The raw text to be synthesized.
          type: string
      type: object
    SynthesizeLongAudioMetadata:
      description: Metadata for response returned by the `SynthesizeLongAudio` method.
      properties:
        progressPercentage:
          description: The progress of the most recent processing update in percentage, ie. 70.0%.
          format: double
          type: number
        startTime:
          description: Time when the request was received.
          format: google-datetime
          type: string
      type: object
    SynthesizeLongAudioRequest:
      description: The top-level message sent by the client for the `SynthesizeLongAudio` method.
      properties:
        audioConfig:
          $ref: "#/components/schemas/AudioConfig"
          description: Required. The configuration of the synthesized audio.
        input:
          $ref: "#/components/schemas/SynthesisInput"
          description: Required. The Synthesizer requires either plain text or SSML as input.
        outputGcsUri:
          description: "Specifies a Cloud Storage URI for the synthesis results. Must be specified in the format: `gs://bucket_name/object_name`, and the bucket must already exist."
          type: string
        voice:
          $ref: "#/components/schemas/VoiceSelectionParams"
          description: The desired voice of the synthesized audio.
      type: object
    SynthesizeSpeechRequest:
      description: The top-level message sent by the client for the `SynthesizeSpeech` method.
      properties:
        audioConfig:
          $ref: "#/components/schemas/AudioConfig"
          description: Required. The configuration of the synthesized audio.
        input:
          $ref: "#/components/schemas/SynthesisInput"
          description: Required. The Synthesizer requires either plain text or SSML as input.
        voice:
          $ref: "#/components/schemas/VoiceSelectionParams"
          description: Required. The desired voice of the synthesized audio.
      type: object
    SynthesizeSpeechResponse:
      description: The message returned to the client by the `SynthesizeSpeech` method.
      properties:
        audioContent:
          description: "The audio data bytes encoded as specified in the request, including the header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). For LINEAR16 audio, we include the WAV header. Note: as with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64."
          format: byte
          type: string
      type: object
    Voice:
      description: Description of a voice supported by the TTS service.
      properties:
        languageCodes:
          description: The languages that this voice supports, expressed as [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. "en-US", "es-419", "cmn-tw").
          items:
            type: string
          type: array
        name:
          description: The name of this voice. Each distinct voice has a unique name.
          type: string
        naturalSampleRateHertz:
          description: The natural sample rate (in hertz) for this voice.
          format: int32
          type: integer
        ssmlGender:
          description: The gender of this voice.
          enum:
            - SSML_VOICE_GENDER_UNSPECIFIED
            - MALE
            - FEMALE
            - NEUTRAL
          type: string
      type: object
    VoiceSelectionParams:
      description: Description of which voice to use for a synthesis request.
      properties:
        customVoice:
          $ref: "#/components/schemas/CustomVoiceParams"
          description: The configuration for a custom voice. If [CustomVoiceParams.model] is set, the service will choose the custom voice matching the specified configuration.
        languageCode:
          description: Required. The language (and potentially also the region) of the voice expressed as a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag, e.g. "en-US". This should not include a script tag (e.g. use "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred from the input provided in the SynthesisInput. The TTS service will use this parameter to help choose an appropriate voice. Note that the TTS service may choose a voice with a slightly different language code than the one selected; it may substitute a different region (e.g. using en-US rather than en-CA if there isn't a Canadian voice available), or even a different language, e.g. using "nb" (Norwegian Bokmal) instead of "no" (Norwegian)".
          type: string
        name:
          description: The name of the voice. If not set, the service will choose a voice based on the other parameters such as language_code and gender.
          type: string
        ssmlGender:
          description: The preferred gender of the voice. If not set, the service will choose a voice based on the other parameters such as language_code and name. Note that this is only a preference, not requirement; if a voice of the appropriate gender is not available, the synthesizer should substitute a voice with a different gender rather than failing the request.
          enum:
            - SSML_VOICE_GENDER_UNSPECIFIED
            - MALE
            - FEMALE
            - NEUTRAL
          type: string
      type: object
  securitySchemes:
    Oauth2:
      description: Oauth 2.0 implicit authentication
      flows:
        implicit:
          authorizationUrl: https://accounts.google.com/o/oauth2/auth
          scopes:
            https://www.googleapis.com/auth/cloud-platform: See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
      type: oauth2
    Oauth2c:
      description: Oauth 2.0 authorizationCode authentication
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.google.com/o/oauth2/auth
          scopes:
            https://www.googleapis.com/auth/cloud-platform: See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
          tokenUrl: https://accounts.google.com/o/oauth2/token
      type: oauth2
