import requests
url = "https://api.ai21.com/studio/v1/library/files"
payload = {
"name": "<string>",
"status": "<string>",
"label": ["<string>"],
"Pagination": {
"offset": 123,
"limit": 123
}
}
headers = {"Content-Type": "application/json"}
response = requests.request("GET", url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'GET',
headers: {'Content-Type': 'application/json'},
body: '{"name":"<string>","path":"<string>","status":"<string>","label":["<string>"],"Pagination":{"offset":123,"limit":123}}'
};
fetch('https://api.ai21.com/studio/v1/library/files', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ai21.com/studio/v1/library/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "{\n \"name\": \"<string>\",\n \"path\": \"<string>\",\n \"status\": \"<string>\",\n \"label\": [\n \"<string>\"\n ],\n \"Pagination\": {\n \"offset\": 123,\n \"limit\": 123\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.ai21.com/studio/v1/library/files"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"path\": \"<string>\",\n \"status\": \"<string>\",\n \"label\": [\n \"<string>\"\n ],\n \"Pagination\": {\n \"offset\": 123,\n \"limit\": 123\n }\n}")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
curl --request GET \
--url https://api.ai21.com/studio/v1/library/files \
--header 'Content-Type: application/json' \
--data '{
"name": "<string>",
"path": "<string>",
"status": "<string>",
"label": [
"<string>"
],
"Pagination": {
"offset": 123,
"limit": 123
}
HttpResponse<String> response = Unirest.get("https://api.ai21.com/studio/v1/library/files")
.header("Content-Type", "application/json")
.queryString("name", "<string>")
.queryString("path", "<string>")
.queryString("status", "<string>")
.queryString("label", "<string>")
.queryString("offset", 123)
.queryString("limit", 123)
.asString();
File Library Management
List library files
Retrieve a list of documents in the user’s library. You can optionally specify a filter to return only files with matching labels.
GET
/
studio
/
v1
/
library
/
files
import requests
url = "https://api.ai21.com/studio/v1/library/files"
payload = {
"name": "<string>",
"status": "<string>",
"label": ["<string>"],
"Pagination": {
"offset": 123,
"limit": 123
}
}
headers = {"Content-Type": "application/json"}
response = requests.request("GET", url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'GET',
headers: {'Content-Type': 'application/json'},
body: '{"name":"<string>","path":"<string>","status":"<string>","label":["<string>"],"Pagination":{"offset":123,"limit":123}}'
};
fetch('https://api.ai21.com/studio/v1/library/files', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ai21.com/studio/v1/library/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "{\n \"name\": \"<string>\",\n \"path\": \"<string>\",\n \"status\": \"<string>\",\n \"label\": [\n \"<string>\"\n ],\n \"Pagination\": {\n \"offset\": 123,\n \"limit\": 123\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.ai21.com/studio/v1/library/files"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"path\": \"<string>\",\n \"status\": \"<string>\",\n \"label\": [\n \"<string>\"\n ],\n \"Pagination\": {\n \"offset\": 123,\n \"limit\": 123\n }\n}")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
curl --request GET \
--url https://api.ai21.com/studio/v1/library/files \
--header 'Content-Type: application/json' \
--data '{
"name": "<string>",
"path": "<string>",
"status": "<string>",
"label": [
"<string>"
],
"Pagination": {
"offset": 123,
"limit": 123
}
HttpResponse<String> response = Unirest.get("https://api.ai21.com/studio/v1/library/files")
.header("Content-Type", "application/json")
.queryString("name", "<string>")
.queryString("path", "<string>")
.queryString("status", "<string>")
.queryString("label", "<string>")
.queryString("offset", 123)
.queryString("limit", 123)
.asString();
When specifying qualifiers with your request, only files that match all qualifiers will be returned. For example, if you specify
label='financial' and status='UPLOADED', only files with the label ‘financial’ and status ‘UPLOADED’ will be returned.
Request parameters
The following optional parameters can be used to filter your results.The full name of the uploaded file, without any path parameters. So: “mydoc.txt”, not “/users/benfranklyn/Documents/mydoc.txt”. Does not match name substrings, so “doc.txt” does not match “mydoc.txt”.
Status of the file in the library. Supported values:
DB_RECORD_CREATEDUPLOADEDUPLOAD_FAILEDPROCESSEDPROCESSING_FAILED
Return only files with this label. Label matching is case-sensitive, and will not match substrings.
Responses
Response 200
A successful response returns an array of file metadata items.import requests
url = "https://api.ai21.com/studio/v1/library/files"
payload = {
"name": "<string>",
"status": "<string>",
"label": ["<string>"],
"Pagination": {
"offset": 123,
"limit": 123
}
}
headers = {"Content-Type": "application/json"}
response = requests.request("GET", url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'GET',
headers: {'Content-Type': 'application/json'},
body: '{"name":"<string>","path":"<string>","status":"<string>","label":["<string>"],"Pagination":{"offset":123,"limit":123}}'
};
fetch('https://api.ai21.com/studio/v1/library/files', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ai21.com/studio/v1/library/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "{\n \"name\": \"<string>\",\n \"path\": \"<string>\",\n \"status\": \"<string>\",\n \"label\": [\n \"<string>\"\n ],\n \"Pagination\": {\n \"offset\": 123,\n \"limit\": 123\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.ai21.com/studio/v1/library/files"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"path\": \"<string>\",\n \"status\": \"<string>\",\n \"label\": [\n \"<string>\"\n ],\n \"Pagination\": {\n \"offset\": 123,\n \"limit\": 123\n }\n}")
req, _ := http.NewRequest("GET", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
curl --request GET \
--url https://api.ai21.com/studio/v1/library/files \
--header 'Content-Type: application/json' \
--data '{
"name": "<string>",
"path": "<string>",
"status": "<string>",
"label": [
"<string>"
],
"Pagination": {
"offset": 123,
"limit": 123
}
HttpResponse<String> response = Unirest.get("https://api.ai21.com/studio/v1/library/files")
.header("Content-Type", "application/json")
.queryString("name", "<string>")
.queryString("path", "<string>")
.queryString("status", "<string>")
.queryString("label", "<string>")
.queryString("offset", 123)
.queryString("limit", 123)
.asString();
Was this page helpful?
⌘I

