How to set the language for API Rest or SOAP?

Results are returned, by default, in the organization's language. Using the toLabel function returns localized values; this is required to support multi-language organizations. In neither case can you specify the translation language to perform transactions in. You would have to update the user's language key before running the transaction.


With SOAP API, you can set LocaleOptions in the request header.

LocaleOptions
Specifies the language of the labels returned.

Note that it will only work for certain 'describe' calls. I haven't found a corresponding option for REST.


I know this is an old question. So I add this comment just to help others that are in my situation. I was struggling to find out how to get translated texts for picklists through the REST API. We already have set up an "SF-Connector" which wraps the REST API so it was not an option to create a new SOAP-version or go this way. What we found was that we could just use the "accept-language"-header, and use the SF-language codes

A curl example:

curl "https://anSFInstance.salesforce.com/services/data/v48.0/ui-api/object-info/FinServ__FinancialGoal__c/picklist-values/[someRecordTypeID]/PP_Goal__c/" -H 'Authorization: Bearer [a bearer token]' -H 'Accept-Language: no'