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

# Translate multiple segments



## OpenAPI

````yaml /openapi/phrase-byo-mt.json post /translate
openapi: 3.0.3
info:
  title: BYO Engine API
  version: 1.0.6
  description: >
    This file can be viewed online in the [Swagger
    Editor](https://editor.swagger.io/).


    A minimal BYO Engine machine translation API specification.

    It supports the following operations and features:

    - supported languages

    - engine status

    - synchronous and asynchronous multi-segment translation operations

    - ad-hoc glossaries

    - custom metadata (request and segment level)


    For authentication you can use either the [OAuth client credentials
    flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow)
    or an API token.


    For the asynchronous endpoints please ensure thread safety and proper
    concurrency handling so that multiple request do not accidentally overwrite
    each other's data.


    For your reference, you can check out this simple [demo
    implementation](https://github.com/phrase/custom.adapter).


    ---
servers:
  - url: https://api.mtengine.example.com
    description: Sample base URL for an external MT engine
security:
  - OAuth2: []
  - ApiKeyAuth: []
paths:
  /translate:
    post:
      tags:
        - Synchronous translation
      summary: Translate multiple segments
      operationId: translateTexts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TranslateRequest'
      responses:
        '200':
          description: Translated segments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TranslateResponse'
        '429':
          $ref: '#/components/responses/Backoff'
        default:
          $ref: '#/components/responses/Error'
      security:
        - OAuth2:
            - translate:write
        - ApiKeyAuth: []
components:
  schemas:
    TranslateRequest:
      type: object
      required:
        - sourceLanguage
        - targetLanguage
        - segments
      properties:
        sourceLanguage:
          allOf:
            - $ref: '#/components/schemas/Locale'
          example: en
        targetLanguage:
          allOf:
            - $ref: '#/components/schemas/Locale'
          example: es
        segments:
          type: array
          minItems: 1
          maxItems: 500
          items:
            $ref: '#/components/schemas/Segment'
        glossary:
          type: array
          minItems: 0
          maxItems: 500
          description: List of glossary entries to apply during translation
          items:
            $ref: '#/components/schemas/GlossaryEntry'
        metadata:
          $ref: '#/components/schemas/Metadata'
    TranslateResponse:
      type: object
      required:
        - sourceLanguage
        - targetLanguage
        - segments
      properties:
        sourceLanguage:
          allOf:
            - $ref: '#/components/schemas/Locale'
          example: en
        targetLanguage:
          allOf:
            - $ref: '#/components/schemas/Locale'
          example: es
        segments:
          type: array
          items:
            $ref: '#/components/schemas/TranslatedSegment'
        metadata:
          $ref: '#/components/schemas/Metadata'
    Locale:
      type: string
      description: Phrase language codes
      enum:
        - aa
        - ab
        - ace
        - ace_arab
        - ace_latn
        - ach
        - acq
        - acq_ye
        - af
        - af_na
        - af_za
        - afb
        - afb_sa
        - agr
        - ak
        - ak_gh
        - an
        - am
        - am_et
        - apc
        - ar
        - ar_001
        - ar_145
        - ar_ae
        - ar_arabizi
        - ar_bh
        - ar_dj
        - ar_dz
        - ar_eg
        - ar_eh
        - ar_er
        - ar_il
        - ar_iq
        - ar_jo
        - ar_km
        - ar_kw
        - ar_latn
        - ar_lb
        - ar_ly
        - ar_ma
        - ar_mod
        - ar_mr
        - ar_om
        - ar_ps
        - ar_qa
        - ar_sa
        - ar_sd
        - ar_sn
        - ar_so
        - ar_ss
        - ar_sy
        - ar_tn
        - ar_ye
        - arc
        - ars
        - ars_sa
        - as
        - as_in
        - as_latn
        - ast
        - av
        - ay
        - ayh
        - ayh_ye
        - ayn
        - ayn_ye
        - az
        - az_az
        - az_arab
        - az_arab_ir
        - az_cyrl
        - az_cyrl_az
        - az_latn
        - az_latn_az
        - ba
        - ba_ru
        - bal
        - ban
        - bci
        - be
        - be_by
        - bem
        - bfa
        - bg
        - bg_bg
        - bg_latn
        - bg_latn_bg
        - bh
        - bho
        - bi
        - bik
        - bin
        - bin_ng
        - bjn
        - bjn_arab
        - bjn_latn
        - bm
        - bm_latn_ml
        - bn
        - bng
        - bng_latn
        - bn_bd
        - bn_in
        - bn_latn
        - bo
        - br
        - bs
        - bs_ba
        - bs_cyrl
        - bs_cyrl_ba
        - bs_latn
        - bs_latn_ba
        - bsq
        - bua
        - byn
        - byn_er
        - bwr
        - ca
        - ca_ad
        - ca_es
        - ca_es_valencia
        - cak
        - cbk
        - cdo
        - ce
        - ce_ru
        - ceb
        - ceb_ph
        - cfm
        - ch
        - chk
        - chr
        - cja
        - cja_kh
        - cjk
        - cjk_ao
        - ckb
        - ckl
        - cld
        - cmn
        - cmn_my
        - cnh
        - cnr
        - cnr_cyrl
        - cnr_latn
        - co
        - co_fr
        - cor
        - cr
        - crh
        - crh_latn
        - crh_cyrl
        - crp
        - crs
        - cs
        - cs_cz
        - ctd
        - ctg
        - ctg_bd
        - cv
        - cy
        - cy_gb
        - da
        - da_dk
        - da_fo
        - da_gl
        - dag
        - daw
        - de
        - de_at
        - de_be
        - de_ch
        - de_de
        - de_dk
        - de_it
        - de_li
        - de_lu
        - de_nl
        - din
        - din_ss
        - dje
        - doi
        - dsb
        - dtk
        - dv
        - dv_mv
        - dyu
        - dyu_ci
        - dz
        - ee
        - ee_gh
        - efi
        - eky
        - el
        - el_cy
        - el_gr
        - el_latn
        - el_latn_gr
        - emk
        - en
        - en_001
        - en_029
        - en_039
        - en_150
        - en_151
        - en_154
        - en_155
        - en_ae
        - en_af
        - en_ag
        - en_ai
        - en_al
        - en_am
        - en_aq
        - en_as
        - en_au
        - en_ar
        - en_aw
        - en_ax
        - en_az
        - en_ba
        - en_bb
        - en_bd
        - en_be
        - en_bh
        - en_bl
        - en_bm
        - en_bn
        - en_bq
        - en_br
        - en_bs
        - en_bt
        - en_bw
        - en_bz
        - en_ca
        - en_cc
        - en_cl
        - en_ch
        - en_ck
        - en_cn
        - en_co
        - en_cw
        - en_cx
        - en_cy
        - en_cz
        - en_de
        - en_dk
        - en_dm
        - en_dz
        - en_eg
        - en_er
        - en_es
        - en_et
        - en_fi
        - en_fj
        - en_fk
        - en_fm
        - en_fo
        - en_fr
        - en_gb
        - en_gd
        - en_ge
        - en_gf
        - en_gg
        - en_gh
        - en_gi
        - en_gl
        - en_gm
        - en_gp
        - en_gq
        - en_gr
        - en_gs
        - en_gu
        - en_gw
        - en_gy
        - en_hk
        - en_hm
        - en_ht
        - en_hu
        - en_id
        - en_ie
        - en_il
        - en_im
        - en_in
        - en_io
        - en_iq
        - en_is
        - en_it
        - en_ja
        - en_je
        - en_jm
        - en_jo
        - en_jp
        - en_ke
        - en_kh
        - en_ki
        - en_km
        - en_kn
        - en_kr
        - en_kw
        - en_ky
        - en_kz
        - en_la
        - en_lb
        - en_lc
        - en_lk
        - en_lr
        - en_ls
        - en_ly
        - en_ma
        - en_me
        - en_mg
        - en_mh
        - en_mk
        - en_mm
        - en_mn
        - en_mo
        - en_mp
        - en_mq
        - en_ms
        - en_mt
        - en_mu
        - en_mv
        - en_mw
        - en_mx
        - en_my
        - en_mz
        - en_na
        - en_nf
        - en_ng
        - en_nl
        - en_no
        - en_np
        - en_nr
        - en_nu
        - en_nz
        - en_om
        - en_pe
        - en_pg
        - en_ph
        - en_pk
        - en_pm
        - en_pn
        - en_pr
        - en_pt
        - en_pw
        - en_qa
        - en_rs
        - en_ru
        - en_rw
        - en_sa
        - en_sb
        - en_sc
        - en_sd
        - en_se
        - en_sg
        - en_sh
        - en_si
        - en_sk
        - en_sl
        - en_so
        - en_sr
        - en_ss
        - en_sx
        - en_sy
        - en_sz
        - en_tc
        - en_th
        - en_tk
        - en_tl
        - en_tm
        - en_tn
        - en_to
        - en_tr
        - en_tt
        - en_tv
        - en_tw
        - en_tz
        - en_ug
        - en_um
        - en_us
        - en_vc
        - en_vg
        - en_vi
        - en_vn
        - en_vu
        - en_wf
        - en_ws
        - en_ye
        - en_za
        - en_zm
        - en_zw
        - eo
        - es
        - es_001
        - es_419
        - es_ad
        - es_ar
        - es_aw
        - es_bb
        - es_bo
        - es_bz
        - es_cl
        - es_co
        - es_cr
        - es_cu
        - es_do
        - es_ec
        - es_es
        - es_gq
        - es_gt
        - es_hn
        - es_jm
        - es_mx
        - es_ni
        - es_pa
        - es_pe
        - es_pr
        - es_py
        - es_sv
        - es_tt
        - es_us
        - es_uy
        - es_ve
        - et
        - et_ee
        - eu
        - eu_es
        - ewo
        - ewo_cm
        - fa
        - fa_af
        - fa_ir
        - fa_latn
        - fa_latn_ir
        - fan
        - fat
        - ff
        - ff_latn_gm
        - ff_latn_gn
        - ff_latn_gw
        - fi
        - fi_fi
        - fia
        - fia_arab
        - fia_arab_eg
        - fia_latn
        - fil
        - fil_ph
        - fj
        - fj_fj
        - fkv
        - fo
        - fo_fo
        - fon
        - fr
        - fr_001
        - fr_015
        - fr_ad
        - fr_be
        - fr_bf
        - fr_bi
        - fr_bj
        - fr_bl
        - fr_ca
        - fr_cd
        - fr_cf
        - fr_cg
        - fr_ch
        - fr_ci
        - fr_cm
        - fr_dj
        - fr_dz
        - fr_fr
        - fr_ga
        - fr_gf
        - fr_gn
        - fr_gp
        - fr_gq
        - fr_ht
        - fr_km
        - fr_lb
        - fr_lu
        - fr_ma
        - fr_mc
        - fr_mf
        - fr_mg
        - fr_ml
        - fr_mq
        - fr_mr
        - fr_mu
        - fr_nc
        - fr_ne
        - fr_pf
        - fr_pm
        - fr_re
        - fr_rw
        - fr_sc
        - fr_sn
        - fr_td
        - fr_tf
        - fr_tg
        - fr_tn
        - fr_wf
        - fr_yt
        - fit
        - fub
        - fuc
        - fur
        - fvr
        - fy
        - ga
        - ga_ie
        - gag
        - gan
        - gd
        - gd_gb
        - gd_ie
        - gil
        - gl
        - gl_es
        - glw
        - gn
        - gom
        - gu
        - gu_in
        - gur
        - gur_gh
        - guw
        - gux
        - guz
        - guz_ke
        - ha
        - ha_latn_ne
        - ha_latn_ng
        - hak
        - haw
        - haz
        - hbs
        - he
        - he_il
        - he_ru
        - hi
        - hi_fj
        - hi_in
        - hi_latn
        - hia
        - hig
        - hil
        - hil_ph
        - hlt
        - hmn
        - hnj
        - hr
        - hr_ba
        - hr_hr
        - hsb
        - ht
        - ht_ht
        - hu
        - hu_hu
        - hup
        - hy
        - hy_am
        - hy_latn
        - hy_latn_am
        - hz
        - ia
        - ibb
        - id
        - id_id
        - ig
        - ig_ng
        - ii
        - ike
        - ikt
        - ilo
        - ilo_ph
        - in
        - in_id
        - inh
        - is
        - is_is
        - iso
        - it
        - it_ch
        - it_it
        - it_sm
        - it_va
        - iu
        - iu_ca
        - iu_cans
        - iu_cans_ca
        - iu_latn
        - ium
        - iw
        - iw_il
        - ja
        - ja_jp
        - ja_jp_jp
        - ja_us
        - jam
        - ji
        - jra
        - jv
        - ka
        - ka_ge
        - kaa
        - kab
        - kab_latn_dz
        - kac
        - kac_mm
        - kam
        - kam_ke
        - kar
        - kbd
        - kea
        - kea_cv
        - kek
        - kg
        - kg_ao
        - kha
        - khq
        - khq_ml
        - ki
        - kj
        - kl
        - kl_gl
        - kln
        - kln_ke
        - kk
        - kk_latn
        - kk_kz
        - kk_cyrl_kz
        - km
        - km_kh
        - km_vn
        - kmb
        - kmb_ao
        - kmr
        - kmr_sy
        - kmr_tr
        - kn
        - kn_in
        - ko
        - ko_kp
        - ko_kr
        - ko_us
        - kok
        - kok_in
        - kos
        - kpe
        - kr
        - kr_latn
        - kri
        - krl
        - ks
        - ks_arab
        - ks_deva
        - ktu
        - ku
        - ku_arab
        - ku_arab_iq
        - kun
        - kv
        - ky
        - ky_kg
        - kyu
        - kz
        - la
        - lb
        - lb_lu
        - lg
        - lg_ug
        - li
        - lif
        - lij
        - lir
        - lmo
        - ln
        - ln_ao
        - ln_cd
        - ln_cf
        - ln_cg
        - lo
        - lo_la
        - lol
        - lt
        - lt_lt
        - lt_lv
        - lt_ru
        - ltg
        - lu
        - lua
        - luo
        - luo_ke
        - lus
        - lv
        - lv_lv
        - lv_ru
        - mad
        - mai
        - man
        - mam
        - mdh
        - mer
        - mfe
        - mfi
        - mfi_cm
        - mfi_ng
        - mg
        - mg_mg
        - mh
        - mhr
        - mi
        - mi_nz
        - mi_in
        - min
        - min_arab
        - min_latn
        - mk
        - mk_mk
        - ml
        - ml_in
        - mn
        - mn_mn
        - mn_mong
        - mn_mong_cn
        - mni
        - mni_mtei
        - mnk
        - mnw
        - moh
        - mos
        - mr
        - mr_in
        - mrl
        - mrw
        - mrt
        - ms
        - ms_arab
        - ms_arab_my
        - ms_bn
        - ms_latn_my
        - ms_latn_sg
        - ms_my
        - ms_sg
        - mt
        - mt_mt
        - mul
        - mww
        - mxt
        - my
        - my_mm
        - myx
        - nan
        - nan_tw
        - nb
        - nb_no
        - nd
        - nd_zw
        - ndc
        - nds
        - ne
        - ne_np
        - new
        - ngc
        - nl
        - nl_001
        - nl_be
        - nl_cw
        - nl_nl
        - nl_sr
        - nn
        - nn_no
        - nnb
        - 'no'
        - no_no
        - no_no_ny
        - nr
        - nso
        - nso_za
        - nuj
        - nus
        - nv
        - ny
        - ny_mw
        - ny_zm
        - nyn
        - oc
        - oj
        - ojb
        - ojc
        - ojg
        - ojs
        - ojw
        - om
        - om_et
        - om_ke
        - or
        - or_in
        - or_latn
        - or_latn_in
        - os
        - otq
        - pa
        - pa_arab
        - pa_arab_pk
        - pa_guru
        - pa_guru_in
        - pa_guru_pk
        - pa_ca
        - pa_in
        - pa_pk
        - pag
        - pam
        - pap
        - pau
        - pcd
        - pcm
        - pdc
        - pga
        - pga_latn
        - pis
        - pl
        - pl_pl
        - pon
        - prs
        - prs_af
        - ps
        - ps_af
        - pt
        - pt_001
        - pt_ao
        - pt_br
        - pt_cv
        - pt_gw
        - pt_mz
        - pt_pt
        - pt_st
        - pt_tl
        - pt_us
        - qu
        - qu_bo
        - qu_ec
        - qu_gt
        - qu_pe
        - quc
        - quy
        - quz
        - quz_pe
        - raj
        - rcf
        - rhg
        - rhg_latn
        - rhg_rohg
        - rhg_beng
        - rhl
        - rm
        - rm_ch
        - rmc
        - rmc_cyrl
        - rmc_latn
        - rmy
        - rmy_cyrl
        - rmy_latn
        - rn
        - rn_bi
        - ro
        - ro_md
        - ro_ro
        - rom
        - ru
        - ru_by
        - ru_ee
        - ru_il
        - ru_kg
        - ru_kz
        - ru_latn
        - ru_latn_ru
        - ru_lt
        - ru_lv
        - ru_md
        - ru_ru
        - ru_tj
        - ru_tm
        - ru_ua
        - ru_uz
        - rue
        - rup
        - rw
        - rw_rw
        - sa
        - sat
        - sb
        - sc
        - sc_it
        - scn
        - sd
        - sd_arab
        - sd_arab_pk
        - sd_deva
        - sd_deva_pk
        - sdh
        - sdh_arab
        - se
        - se_fi
        - se_no
        - se_se
        - seh
        - ses
        - sg
        - sg_cf
        - sgc
        - shn
        - shn_mm
        - shr
        - shu
        - shu_latn
        - shu_latn_ng
        - shu_td
        - si
        - sid
        - si_lk
        - sk
        - sk_sk
        - sl
        - sl_sl
        - sl_si
        - sm
        - sm_ws
        - sma
        - sma_no
        - sma_se
        - smj
        - smj_no
        - smj_se
        - smn
        - smn_fi
        - sms
        - sms_fi
        - sn
        - snk
        - so
        - so_dj
        - so_et
        - so_ke
        - so_latn_so
        - so_so
        - sq
        - sq_al
        - sq_mk
        - sq_xk
        - sr
        - sr_ba
        - sr_cs
        - sr_me
        - sr_rs
        - sr_cyrl
        - sr_cyrl_ba
        - sr_cyrl_me
        - sr_cyrl_rs
        - sr_latn
        - sr_latn_ba
        - sr_latn_cs
        - sr_latn_me
        - sr_latn_rs
        - ss
        - ss_sz
        - st
        - st_ls
        - st_za
        - su
        - sv
        - sv_ax
        - sv_fi
        - sv_se
        - sv_sk
        - sw
        - sw_cd
        - sw_ke
        - sw_tz
        - sw_ug
        - syl
        - syr
        - syr_sy
        - szl
        - szl_pl
        - ta
        - ta_in
        - ta_latn
        - ta_latn_in
        - ta_lk
        - ta_my
        - ta_sg
        - taq
        - taq_ml
        - tbf
        - tcs
        - tcy
        - te
        - te_in
        - te_latn
        - te_latn_in
        - teo
        - teo_ug
        - tet
        - tg
        - tg_tj
        - tg_cyrl
        - tg_cyrl_tj
        - th
        - th_th
        - th_th_th
        - ti
        - ti_et
        - ti_er
        - tig
        - tig_er
        - tk
        - tk_iq
        - tk_tm
        - tl
        - tl_ph
        - tlh
        - tlh_latn
        - tlh_piqd
        - tn
        - tn_bw
        - tn_za
        - to
        - to_nz
        - to_to
        - tob
        - tpi
        - tr
        - tr_tr
        - ts
        - ts_za
        - tsg
        - tsg_ph
        - tt
        - tt_ru
        - tum
        - tum_latn
        - tuq
        - tw
        - ty
        - tzm
        - ug
        - ug_arab
        - ug_cn
        - uk
        - uk_latn
        - uk_latn_ua
        - uk_pl
        - uk_ua
        - umb
        - umb_ao
        - ur
        - ur_bd
        - ur_in
        - ur_latn
        - ur_lk
        - ur_pk
        - uz
        - uz_cyrl
        - uz_cyrl_uz
        - uz_latn
        - uz_latn_uz
        - uz_uz
        - ve
        - ve_za
        - vec
        - vi
        - vi_us
        - vi_vn
        - vls
        - wa
        - war
        - wen
        - wes
        - wes_cm
        - wes_ng
        - wo
        - wo_sn
        - xh
        - xh_za
        - xsm
        - xsm_gh
        - yao
        - yap
        - yi
        - ymm
        - yo
        - yo_ng
        - ypk
        - yua
        - yue
        - za
        - zgh
        - zgh_dz
        - zh
        - zh_cn
        - zh_hans
        - zh_hans_cn
        - zh_hans_hk
        - zh_hans_kr
        - zh_hans_my
        - zh_hans_sg
        - zh_hans_us
        - zh_hant
        - zh_hant_cn
        - zh_hant_hk
        - zh_hant_tw
        - zh_hk
        - zh_my
        - zh_mo
        - zh_sg
        - zh_tw
        - ziw
        - zne
        - zom
        - zu
        - zu_za
        - zyp
        - zza
    Segment:
      allOf:
        - $ref: '#/components/schemas/SegmentBase'
    GlossaryEntry:
      type: object
      required:
        - translation
        - term
      properties:
        translation:
          type: string
          description: Translation of the term
          example: hola
          minLength: 1
          maxLength: 50
        term:
          type: string
          description: Term to be taken into consideration while translating
          example: hello
          minLength: 1
          maxLength: 50
    Metadata:
      type: object
      description: >
        Any custom data in form of key/value pairs.


        Phrase automatically resolves the following placeholders in
        request-level metadata values:


        - `{project_uid}` — TMS project UID

        - `{job_uid}` — TMS job UID

        - `{idm_organization_uid}` — Phrase organization UID
      example:
        formality: informal
        model: model123
        domain: legal
        project_uid: '{project_uid}'
        job_uid: '{job_uid}'
        idm_organization_uid: '{idm_organization_uid}'
      additionalProperties:
        type: string
    TranslatedSegment:
      allOf:
        - $ref: '#/components/schemas/SegmentBase'
        - type: object
          required:
            - translatedText
          properties:
            translatedText:
              type: string
              description: The translated text
              example: ¡Hola Mundo!
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          example: Unauthorized, Invalid token
    SegmentBase:
      type: object
      required:
        - text
      properties:
        idx:
          type: string
          description: >-
            Internal Phrase segment identification. Should not be altered by the
            system.
          example: fff
        text:
          type: string
          description: The text to be translated/returned
          example: Hello World!
        metadata:
          allOf:
            - $ref: '#/components/schemas/Metadata'
          example:
            context: surrounding text
            customKey: customValue
          description: Placeholder for future use
  responses:
    Backoff:
      description: Too many requests
      headers:
        Retry-After:
          description: Time in seconds before the client may retry the request
          schema:
            type: integer
    Error:
      description: Default response in case of any error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    OAuth2:
      type: oauth2
      description: |
        OAuth 2.0 for accessing the MT API.
        Supports client credentials (service-to-service).
      flows:
        clientCredentials:
          tokenUrl: https://auth.example.com/oauth/token
          scopes:
            languages:read: Read supported languages
            status:read: Read engine status
            translate:write: Submit translation request
            translateAsync:write: Submit asynchronous translation request
            translateAsyncStatus:read: Read asynchronous translation status
            translateAsyncResult:read: Read asynchronous translation result
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Token

````