JavaScript
import Indices from 'indicesio';
const client = new Indices({
apiKey: process.env['INDICES_API_KEY'], // This is the default and can be omitted
});
const file = await client.beta.files.create({
content_type: 'x',
name: 'x',
size_bytes: 0,
});
console.log(file.file_id);import os
from indices import Indices
client = Indices(
api_key=os.environ.get("INDICES_API_KEY"), # This is the default and can be omitted
)
file = client.beta.files.create(
content_type="x",
name="x",
size_bytes=0,
)
print(file.file_id)curl --request POST \
--url https://api.indices.io/v1beta/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"size_bytes": 1,
"content_type": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.indices.io/v1beta/files",
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([
'name' => '<string>',
'size_bytes' => 1,
'content_type' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.indices.io/v1beta/files"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"size_bytes\": 1,\n \"content_type\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.indices.io/v1beta/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"size_bytes\": 1,\n \"content_type\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.indices.io/v1beta/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"size_bytes\": 1,\n \"content_type\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"file_id": "<string>",
"upload_url": "<string>",
"upload_headers": {},
"expires_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Files
Initiate a file upload
Create a pending file and get a signed URL to PUT the bytes to.
POST
/
v1beta
/
files
JavaScript
import Indices from 'indicesio';
const client = new Indices({
apiKey: process.env['INDICES_API_KEY'], // This is the default and can be omitted
});
const file = await client.beta.files.create({
content_type: 'x',
name: 'x',
size_bytes: 0,
});
console.log(file.file_id);import os
from indices import Indices
client = Indices(
api_key=os.environ.get("INDICES_API_KEY"), # This is the default and can be omitted
)
file = client.beta.files.create(
content_type="x",
name="x",
size_bytes=0,
)
print(file.file_id)curl --request POST \
--url https://api.indices.io/v1beta/files \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"size_bytes": 1,
"content_type": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.indices.io/v1beta/files",
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([
'name' => '<string>',
'size_bytes' => 1,
'content_type' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.indices.io/v1beta/files"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"size_bytes\": 1,\n \"content_type\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.indices.io/v1beta/files")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"size_bytes\": 1,\n \"content_type\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.indices.io/v1beta/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"size_bytes\": 1,\n \"content_type\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"file_id": "<string>",
"upload_url": "<string>",
"upload_headers": {},
"expires_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Enter your API key as the bearer token. Set header: Authorization to Bearer <api_key>
Body
application/json
Response
Successful response
Server-assigned ID of the pending file.
Signed URL the sandbox must PUT the file bytes to.
Headers that must be sent verbatim with the PUT; they are covered by the URL signature.
Show child attributes
Show child attributes
When the upload URL stops being valid.