import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const objectView = await client.objects.create({ content_type: 'unspecified', name: 'name' });
console.log(objectView.id);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
object_view = client.objects.create(
content_type="unspecified",
name="name",
)
print(object_view.id)curl --request POST \
--url https://api.runloop.ai/v1/objects \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"metadata": {},
"ttl_ms": 123
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/v1/objects",
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>',
'metadata' => [
],
'ttl_ms' => 123
]),
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.runloop.ai/v1/objects"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"metadata\": {},\n \"ttl_ms\": 123\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.runloop.ai/v1/objects")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"metadata\": {},\n \"ttl_ms\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/v1/objects")
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 \"metadata\": {},\n \"ttl_ms\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"state": "UPLOADING",
"content_type": "unspecified",
"create_time_ms": 123,
"size_bytes": 123,
"delete_after_time_ms": 123,
"metadata": {},
"upload_url": "<string>"
}Create an Object.
Create a new Object with content and metadata. The Object will be assigned a unique ID.
import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const objectView = await client.objects.create({ content_type: 'unspecified', name: 'name' });
console.log(objectView.id);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
object_view = client.objects.create(
content_type="unspecified",
name="name",
)
print(object_view.id)curl --request POST \
--url https://api.runloop.ai/v1/objects \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"metadata": {},
"ttl_ms": 123
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/v1/objects",
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>',
'metadata' => [
],
'ttl_ms' => 123
]),
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.runloop.ai/v1/objects"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"metadata\": {},\n \"ttl_ms\": 123\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.runloop.ai/v1/objects")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"metadata\": {},\n \"ttl_ms\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/v1/objects")
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 \"metadata\": {},\n \"ttl_ms\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"state": "UPLOADING",
"content_type": "unspecified",
"create_time_ms": 123,
"size_bytes": 123,
"delete_after_time_ms": 123,
"metadata": {},
"upload_url": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Parameters required to create a new Object.
The name of the Object.
The content type of the Object.
unspecified, text, binary, gzip, tar, tgz User defined metadata to attach to the object for organization.
Show child attributes
Show child attributes
Optional lifetime of the object in milliseconds, after which the object is automatically deleted. Time starts ticking after the object is created.
Response
Object created successfully. Returns the Object with metadata.
An Object represents a stored data entity with metadata.
The unique identifier of the Object.
The name of the Object.
The current state of the Object.
UPLOADING, READ_ONLY, DELETED, ERROR The content type of the Object.
unspecified, text, binary, gzip, tar, tgz The creation time of the Object in milliseconds since epoch.
The size of the Object content in bytes (null until uploaded).
The time after which the Object will be deleted in milliseconds since epoch.
User defined metadata to attach to the Object for organization.
Show child attributes
Show child attributes
Presigned URL for uploading content to S3 (only present on create).
Was this page helpful?
