cURL
curl "https://api.phrase.com/v2/accounts/:account_id/search" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-F query=keyword \
-F locale_code=localecode \
-F page=1 \
-F per_page=25 \phrase search in_account \
--account_id <account_id> \
--data '{"q":"keyword","locale_code": "de","page": 1,"per_page": 25}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/accounts/{account_id}/search"
payload = {
"query": "keyword",
"locale_code": "de_DE",
"page": 1,
"per_page": 25,
"project_ids": ["abcd1234abcd1234abcd1234abcd1234"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'keyword',
locale_code: 'de_DE',
page: 1,
per_page: 25,
project_ids: ['abcd1234abcd1234abcd1234abcd1234']
})
};
fetch('https://api.phrase.com/v2/accounts/{account_id}/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phrase.com/v2/accounts/{account_id}/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => 'keyword',
'locale_code' => 'de_DE',
'page' => 1,
'per_page' => 25,
'project_ids' => [
'abcd1234abcd1234abcd1234abcd1234'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phrase.com/v2/accounts/{account_id}/search"
payload := strings.NewReader("{\n \"query\": \"keyword\",\n \"locale_code\": \"de_DE\",\n \"page\": 1,\n \"per_page\": 25,\n \"project_ids\": [\n \"abcd1234abcd1234abcd1234abcd1234\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.phrase.com/v2/accounts/{account_id}/search")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"keyword\",\n \"locale_code\": \"de_DE\",\n \"page\": 1,\n \"per_page\": 25,\n \"project_ids\": [\n \"abcd1234abcd1234abcd1234abcd1234\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/accounts/{account_id}/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"keyword\",\n \"locale_code\": \"de_DE\",\n \"page\": 1,\n \"per_page\": 25,\n \"project_ids\": [\n \"abcd1234abcd1234abcd1234abcd1234\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"query": "keyword",
"excerpt": "excerpt text",
"key": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "key.name",
"plural": false,
"data_type": "string",
"tags": [
"tag 1",
"tag 2"
]
},
"locale": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "German",
"code": "de_DE"
},
"project": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "project name",
"slug": "project-slug",
"main_format": "",
"project_image_url": "",
"created_at": "2021-05-04T14:16:26Z",
"updated_at": "2021-06-14T14:26:09Z",
"account": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "account name",
"slug": "account-slug",
"company": "company name",
"created_at": "2021-04-27T14:27:25Z",
"updated_at": "2021-06-14T14:35:15Z",
"company_logo_url": ""
},
"space": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "space name",
"slug": "space-slug",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z",
"projects_count": 1
}
},
"translation": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"content": "some content",
"unverified": true,
"excluded": false,
"plural_suffix": "",
"key": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "key.name",
"plural": false,
"data_type": "string",
"tags": [
"tag 1",
"tag 2"
]
},
"created_at": "2021-05-04T14:17:04Z",
"updated_at": "2021-05-04T14:17:04Z",
"placeholders": [],
"state": "translated",
"locale": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "German",
"code": "de_DE"
}
},
"other_translations": [
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"content": "some content",
"unverified": true,
"excluded": false,
"plural_suffix": "",
"key": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "key.name",
"plural": false,
"data_type": "string",
"tags": [
"tag 1",
"tag 2"
]
},
"created_at": "2021-05-04T14:17:04Z",
"updated_at": "2021-05-04T14:17:04Z",
"placeholders": [],
"state\"": "translated",
"locale": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en_EN"
}
}
]
}Search
Search across projects
Search for keys and translations in all account projects
Note: Search is limited to 10000 results and may not include recently updated data depending on the project sizes.
POST
/
accounts
/
{account_id}
/
search
cURL
curl "https://api.phrase.com/v2/accounts/:account_id/search" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-F query=keyword \
-F locale_code=localecode \
-F page=1 \
-F per_page=25 \phrase search in_account \
--account_id <account_id> \
--data '{"q":"keyword","locale_code": "de","page": 1,"per_page": 25}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/accounts/{account_id}/search"
payload = {
"query": "keyword",
"locale_code": "de_DE",
"page": 1,
"per_page": 25,
"project_ids": ["abcd1234abcd1234abcd1234abcd1234"]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: 'keyword',
locale_code: 'de_DE',
page: 1,
per_page: 25,
project_ids: ['abcd1234abcd1234abcd1234abcd1234']
})
};
fetch('https://api.phrase.com/v2/accounts/{account_id}/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phrase.com/v2/accounts/{account_id}/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => 'keyword',
'locale_code' => 'de_DE',
'page' => 1,
'per_page' => 25,
'project_ids' => [
'abcd1234abcd1234abcd1234abcd1234'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phrase.com/v2/accounts/{account_id}/search"
payload := strings.NewReader("{\n \"query\": \"keyword\",\n \"locale_code\": \"de_DE\",\n \"page\": 1,\n \"per_page\": 25,\n \"project_ids\": [\n \"abcd1234abcd1234abcd1234abcd1234\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.phrase.com/v2/accounts/{account_id}/search")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"keyword\",\n \"locale_code\": \"de_DE\",\n \"page\": 1,\n \"per_page\": 25,\n \"project_ids\": [\n \"abcd1234abcd1234abcd1234abcd1234\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/accounts/{account_id}/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"keyword\",\n \"locale_code\": \"de_DE\",\n \"page\": 1,\n \"per_page\": 25,\n \"project_ids\": [\n \"abcd1234abcd1234abcd1234abcd1234\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"query": "keyword",
"excerpt": "excerpt text",
"key": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "key.name",
"plural": false,
"data_type": "string",
"tags": [
"tag 1",
"tag 2"
]
},
"locale": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "German",
"code": "de_DE"
},
"project": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "project name",
"slug": "project-slug",
"main_format": "",
"project_image_url": "",
"created_at": "2021-05-04T14:16:26Z",
"updated_at": "2021-06-14T14:26:09Z",
"account": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "account name",
"slug": "account-slug",
"company": "company name",
"created_at": "2021-04-27T14:27:25Z",
"updated_at": "2021-06-14T14:35:15Z",
"company_logo_url": ""
},
"space": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "space name",
"slug": "space-slug",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z",
"projects_count": 1
}
},
"translation": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"content": "some content",
"unverified": true,
"excluded": false,
"plural_suffix": "",
"key": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "key.name",
"plural": false,
"data_type": "string",
"tags": [
"tag 1",
"tag 2"
]
},
"created_at": "2021-05-04T14:17:04Z",
"updated_at": "2021-05-04T14:17:04Z",
"placeholders": [],
"state": "translated",
"locale": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "German",
"code": "de_DE"
}
},
"other_translations": [
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"content": "some content",
"unverified": true,
"excluded": false,
"plural_suffix": "",
"key": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "key.name",
"plural": false,
"data_type": "string",
"tags": [
"tag 1",
"tag 2"
]
},
"created_at": "2021-05-04T14:17:04Z",
"updated_at": "2021-05-04T14:17:04Z",
"placeholders": [],
"state\"": "translated",
"locale": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en_EN"
}
}
]
}Authorizations
TokenBasic
Enter your token in the format token TOKEN
Headers
Two-Factor-Authentication token (optional)
Path Parameters
Account ID
Body
application/json
Search query
Example:
"keyword"
Locale code
Example:
"de_DE"
Page
Example:
1
Number of results per page
Example:
25
Limit the search to the given project codes. When omitted, the search spans every project the user can access in this account.
Example:
["abcd1234abcd1234abcd1234abcd1234"]
Response
OK
Show child attributes
Show child attributes
Example:
null
Show child attributes
Show child attributes
Example:
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en-GB"
}
Show child attributes
Show child attributes
Example:
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Android Project",
"slug": "android_project",
"main_format": "xml",
"project_image_url": "http://assets.example.com/project.png",
"account": "account",
"space": "space",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
}
Show child attributes
Show child attributes
Example:
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"content": "My translation",
"unverified": false,
"excluded": false,
"plural_suffix": "",
"key": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "home.index.headline",
"plural": false,
"use_ordinal_rules": false
},
"locale": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "de",
"code": "de-DE"
},
"placeholders": ["%{count}"],
"state": "translated",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
}
Show child attributes
Show child attributes
Was this page helpful?
⌘I