Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions doc/compiled.json
Original file line number Diff line number Diff line change
Expand Up @@ -5569,7 +5569,7 @@
"/projects/{project_id}/documents": {
"get": {
"summary": "List documents",
"description": "List all documents the current user has access to.",
"description": "Returns all documents in a project that the authenticated user has read access to. A Document is a source file — an HTML or DOCX file — that has been uploaded to Phrase Strings and whose content is segmented into translation keys for localization.\n\nUse this endpoint to enumerate documents before downloading, previewing, or triggering translation workflows for individual files.\n\nThe q parameter performs a prefix match on the document name (case-insensitive). For example, passing q=invoice returns documents whose names begin with \"invoice\" but not documents containing \"invoice\" elsewhere in the name.\n",
"operationId": "documents/list",
"tags": [
"Documents"
Expand All @@ -5579,19 +5579,20 @@
"$ref": "#/components/parameters/X-PhraseApp-OTP"
},
{
"$ref": "#/components/parameters/page"
"$ref": "#/components/parameters/project_id"
},
{
"$ref": "#/components/parameters/per_page"
"$ref": "#/components/parameters/page"
},
{
"$ref": "#/components/parameters/project_id"
"$ref": "#/components/parameters/per_page"
},
{
"description": "Search query. Filters documents by name (case-insensitive substring match).",
"description": "Filter documents by name prefix. Returns documents whose name starts with the given value (case-insensitive).",
"example": "invoice",
"name": "q",
"in": "query",
"example": "invoice",
"required": false,
"schema": {
"type": "string"
}
Expand Down Expand Up @@ -5630,6 +5631,25 @@
"updated_at": "2015-01-28T09:52:53Z"
}
}
},
"examples": {
"success": {
"summary": "Example document list response",
"value": [
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "email.html",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-03-04T11:22:30Z"
},
{
"id": "ef012345ef012345ef012345ef012345",
"name": "invoice.docx",
"created_at": "2015-02-10T14:30:00Z",
"updated_at": "2015-03-01T08:00:00Z"
}
]
}
}
}
},
Expand Down Expand Up @@ -5659,7 +5679,7 @@
},
"403": {
"$ref": "#/components/responses/403",
"description": "Forbidden. Returned when the access token lacks the `read` scope or when the requesting user is not allowed to list documents in this project."
"description": "Forbidden. Returned when the access token lacks the `read` OAuth scope, when the account email is unconfirmed, or when the requesting user does not have read permission on documents in this project."
},
"404": {
"$ref": "#/components/responses/404"
Expand All @@ -5671,7 +5691,7 @@
"x-code-samples": [
{
"lang": "Curl",
"source": "curl \"https://api.phrase.com/v2/documents?project_id=asdf\" \\\n -u USERNAME_OR_ACCESS_TOKEN"
"source": "curl \"https://api.phrase.com/v2/projects/:project_id/documents\" \\\n -u USERNAME_OR_ACCESS_TOKEN"
},
{
"lang": "CLI v2",
Expand Down
31 changes: 24 additions & 7 deletions paths/documents/index.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
---
summary: List documents
description: List all documents the current user has access to.
description: |
Returns all documents in a project that the authenticated user has read access to. A Document is a source file — an HTML or DOCX file — that has been uploaded to Phrase Strings and whose content is segmented into translation keys for localization.

Use this endpoint to enumerate documents before downloading, previewing, or triggering translation workflows for individual files.

The q parameter performs a prefix match on the document name (case-insensitive). For example, passing q=invoice returns documents whose names begin with "invoice" but not documents containing "invoice" elsewhere in the name.
operationId: documents/list
tags:
- Documents
parameters:
- "$ref": "../../parameters.yaml#/X-PhraseApp-OTP"
- "$ref": "../../parameters.yaml#/project_id"
- "$ref": "../../parameters.yaml#/page"
- "$ref": "../../parameters.yaml#/per_page"
- "$ref": "../../parameters.yaml#/project_id"
- description: |-
Search query. Filters documents by name (case-insensitive substring match).
- description: Filter documents by name prefix. Returns documents whose name starts with the given value (case-insensitive).
example: invoice
name: q
in: query
example: invoice
required: false
schema:
type: string
responses:
Expand All @@ -25,6 +30,18 @@ responses:
type: array
items:
"$ref": "../../schemas/document.yaml#/document"
examples:
success:
summary: Example document list response
value:
- id: abcd1234cdef1234abcd1234cdef1234
name: email.html
created_at: '2015-01-28T09:52:53Z'
updated_at: '2015-03-04T11:22:30Z'
- id: ef012345ef012345ef012345ef012345
name: invoice.docx
created_at: '2015-02-10T14:30:00Z'
updated_at: '2015-03-01T08:00:00Z'
headers:
X-Rate-Limit-Limit:
"$ref": "../../headers.yaml#/X-Rate-Limit-Limit"
Expand All @@ -44,13 +61,13 @@ responses:
"$ref": "../../responses.yaml#/401"
'403':
"$ref": "../../responses.yaml#/403"
description: Forbidden. Returned when the access token lacks the `read` scope or when the requesting user is not allowed to list documents in this project.
description: Forbidden. Returned when the access token lacks the `read` OAuth scope, when the account email is unconfirmed, or when the requesting user does not have read permission on documents in this project.
'429':
"$ref": "../../responses.yaml#/429"
x-code-samples:
- lang: Curl
source: |-
curl "https://api.phrase.com/v2/documents?project_id=asdf" \
curl "https://api.phrase.com/v2/projects/:project_id/documents" \
-u USERNAME_OR_ACCESS_TOKEN
- lang: CLI v2
source: |-
Expand Down
Loading