API: Strings
List source strings
GET /api/hives/{slug}/strings
Returns source strings for a Hive, paginated. Requires read ability.
curl "https://www.stringhive.com/api/hives/my-app/strings?per_page=50" \
-H "Authorization: Bearer YOUR_TOKEN"
Query parameters:
| Parameter | Default | Description |
|---|---|---|
page |
1 |
Page number |
per_page |
100 |
Results per page (max 500) |
file |
— | Filter to strings from a specific file |
Response:
{
"data": [
{
"key": "auth.login",
"source_value": "Log in",
"is_plural": false,
"file": "auth.php"
},
{
"key": "items.count",
"source_value": "{count} item|{count} items",
"is_plural": true,
"file": "app.php"
}
],
"meta": {
"current_page": 1,
"last_page": 13,
"per_page": 100,
"total": 1245
}
}
Import source strings
POST /api/hives/{slug}/strings
Creates new strings and updates existing ones. Requires write ability.
curl -X POST https://www.stringhive.com/api/hives/my-app/strings \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"files": {
"auth.php": {
"login": "Log in",
"logout": "Log out",
"register": "Create account"
},
"nav.php": {
"home": "Home",
"settings": "Settings"
}
},
"conflict_strategy": "keep"
}'
Body parameters:
| Parameter | Type | Description |
|---|---|---|
files |
object | Keys are filenames, values are flat or nested key-value objects |
conflict_strategy |
string | keep (default) or clear. Controls what happens to translations when a source changes. |
Response:
{
"created": 3,
"updated": 2,
"unchanged": 1240,
"translations_cleared": 0
}
Errors:
| Status | Reason |
|---|---|
422 |
Your team has hit its string quota |
403 |
Token doesn't have write access to this Hive |
Sync source strings
PUT /api/hives/{slug}/strings
Like import, but also deletes strings that aren't in your payload. Useful for keeping Stringhive in sync with your codebase. Deletion is scoped per file: strings from files not mentioned in the payload are left alone.
Same request shape and response as the import endpoint, plus a deleted count in the response.