GET documents
curl --request GET \
--url https://app.onecodex.com/api/v1/documents/{id} \
--header 'X-API-Key: <api-key>'import requests
url = "https://app.onecodex.com/api/v1/documents/{id}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://app.onecodex.com/api/v1/documents/{id}', 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://app.onecodex.com/api/v1/documents/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.onecodex.com/api/v1/documents/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.onecodex.com/api/v1/documents/{id}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onecodex.com/api/v1/documents/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"$uri": "/api/v1/documents/0d77065796f8d173",
"created_at": "2023-11-07T05:31:56Z",
"downloaders": [
{
"__DOLLAR_REF__": "/api/v1/users/a1b2c3d4e5f67890"
}
],
"filename": "<string>",
"size": 2,
"uploader": {
"__DOLLAR_REF__": "/api/v1/users/a1b2c3d4e5f67890"
}
}Documents
Retrieve A Document
GET
/
api
/
v1
/
documents
/
{id}
GET documents
curl --request GET \
--url https://app.onecodex.com/api/v1/documents/{id} \
--header 'X-API-Key: <api-key>'import requests
url = "https://app.onecodex.com/api/v1/documents/{id}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://app.onecodex.com/api/v1/documents/{id}', 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://app.onecodex.com/api/v1/documents/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.onecodex.com/api/v1/documents/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://app.onecodex.com/api/v1/documents/{id}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onecodex.com/api/v1/documents/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"$uri": "/api/v1/documents/0d77065796f8d173",
"created_at": "2023-11-07T05:31:56Z",
"downloaders": [
{
"__DOLLAR_REF__": "/api/v1/users/a1b2c3d4e5f67890"
}
],
"filename": "<string>",
"size": 2,
"uploader": {
"__DOLLAR_REF__": "/api/v1/users/a1b2c3d4e5f67890"
}
}GET a single Document by its ID.
Authorizations
Path Parameters
Response
200 - application/json
OK
Pattern:
^/api/v1/documents/[a-f0-9]{16}$Example:
"/api/v1/documents/0d77065796f8d173"
An (optionally empty) array of references to users that the document has been shared with. These users are able to download (but not modify) the document.
Show child attributes
Show child attributes
The document filename (e.g., "report.pdf")
The size of the document in bytes.
Required range:
x >= 1A reference to the user that uploaded and owns the document, e.g., {"$ref": "/api/v1/users/5891ee65711c4d5e"}. Only owners can modify a document (with some exceptions in the case of organization accounts configured for multiple users - please contact us if you'd like to discuss this use case).
Show child attributes
Show child attributes
⌘I

