JavaScript
import Moonbase from '@moonbaseai/sdk';
const client = new Moonbase({
apiKey: process.env['MOONBASE_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const moonbaseFile of client.files.list()) {
console.log(moonbaseFile.id);
}require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
page = moonbase.files.list
puts(page)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
page = client.files.list()
page = page.data[0]
print(page.id)package main
import (
"context"
"fmt"
"github.com/moonbaseai/moonbase-sdk-go"
"github.com/moonbaseai/moonbase-sdk-go/option"
)
func main() {
client := moonbase.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Files.List(context.TODO(), moonbase.FileListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
curl --request GET \
--url https://api.moonbase.ai/v0/files \
--header 'Authorization: Bearer <token>'{
"type": "list",
"data": [
{
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "file",
"name": "Example",
"filename": "test.txt",
"size": 3,
"download_url": "https://api.moonbase.ai/asset_redirects/1CLJt2v6592N5WQzNpjpj2?token=eyJfcmFpbHMiOnsiZGF0YSI6eyJpZCI6IjFDTEp0MnY2NTkyTjVXUXpOcGpwajIiLCJibG9iX2lkIjoiMUNMSnQydjVwa3BrQW52ZGdYZkVjRiIsImNyZWF0ZWRfYXQiOiIyMDI1LTAyLTE3VDE2OjAwOjAwLjAwMFoiLCJuYW1lIjoiZmlsZSIsInJlY29yZF9pZCI6IjFDTEp0MnY1YU5kOEc1U0d6RWFlVlUiLCJyZWNvcmRfdHlwZSI6IkxpYnJhcnlBc3NldCJ9LCJleHAiOiIyMDI1LTAyLTE3VDE3OjAwOjAwLjAwMFoiLCJwdXIiOiJyZWRpcmVjdCJ9fQ--f2913cda85a97e3a8afe3b75c764f2dcee6abf98",
"associations": [],
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z"
}
],
"meta": {
"cursors": {}
}
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "400",
"title": "Bad Request",
"detail": "The request could not be understood due to malformed syntax or invalid parameters."
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "401",
"title": "Unauthorized",
"detail": "Invalid or missing API key or JWT. You should provide your Moonbase API Key or JWT in the authorization header, in the format: \"Authorization: Bearer MOONBASE_API_KEY\""
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "403",
"title": "Forbidden"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "429",
"title": "Too Many Requests"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "500",
"title": "Internal Server Error"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "503",
"title": "Service Unavailable",
"detail": "The service is temporarily unavailable, please try again later."
}
]
}Files
List Files
Returns a list of files that you have uploaded.
GET
/
files
JavaScript
import Moonbase from '@moonbaseai/sdk';
const client = new Moonbase({
apiKey: process.env['MOONBASE_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const moonbaseFile of client.files.list()) {
console.log(moonbaseFile.id);
}require "moonbase"
moonbase = Moonbase::Client.new(api_key: "My API Key")
page = moonbase.files.list
puts(page)import os
from moonbase import Moonbase
client = Moonbase(
api_key=os.environ.get("MOONBASE_API_KEY"), # This is the default and can be omitted
)
page = client.files.list()
page = page.data[0]
print(page.id)package main
import (
"context"
"fmt"
"github.com/moonbaseai/moonbase-sdk-go"
"github.com/moonbaseai/moonbase-sdk-go/option"
)
func main() {
client := moonbase.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Files.List(context.TODO(), moonbase.FileListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
curl --request GET \
--url https://api.moonbase.ai/v0/files \
--header 'Authorization: Bearer <token>'{
"type": "list",
"data": [
{
"id": "1CLJt2v5aNd8G5SGzEaeVU",
"type": "file",
"name": "Example",
"filename": "test.txt",
"size": 3,
"download_url": "https://api.moonbase.ai/asset_redirects/1CLJt2v6592N5WQzNpjpj2?token=eyJfcmFpbHMiOnsiZGF0YSI6eyJpZCI6IjFDTEp0MnY2NTkyTjVXUXpOcGpwajIiLCJibG9iX2lkIjoiMUNMSnQydjVwa3BrQW52ZGdYZkVjRiIsImNyZWF0ZWRfYXQiOiIyMDI1LTAyLTE3VDE2OjAwOjAwLjAwMFoiLCJuYW1lIjoiZmlsZSIsInJlY29yZF9pZCI6IjFDTEp0MnY1YU5kOEc1U0d6RWFlVlUiLCJyZWNvcmRfdHlwZSI6IkxpYnJhcnlBc3NldCJ9LCJleHAiOiIyMDI1LTAyLTE3VDE3OjAwOjAwLjAwMFoiLCJwdXIiOiJyZWRpcmVjdCJ9fQ--f2913cda85a97e3a8afe3b75c764f2dcee6abf98",
"associations": [],
"created_at": "2025-02-17T16:00:00.000Z",
"updated_at": "2025-02-17T16:00:00.000Z"
}
],
"meta": {
"cursors": {}
}
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "400",
"title": "Bad Request",
"detail": "The request could not be understood due to malformed syntax or invalid parameters."
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "401",
"title": "Unauthorized",
"detail": "Invalid or missing API key or JWT. You should provide your Moonbase API Key or JWT in the authorization header, in the format: \"Authorization: Bearer MOONBASE_API_KEY\""
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "403",
"title": "Forbidden"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "429",
"title": "Too Many Requests"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "500",
"title": "Internal Server Error"
}
]
}{
"type": "errors",
"errors": [
{
"type": "error",
"status": "503",
"title": "Service Unavailable",
"detail": "The service is temporarily unavailable, please try again later."
}
]
}Authorizations
Your Moonbase API key.
Query Parameters
When specified, returns results starting immediately before the item identified by this cursor. Use the cursor value from the response's metadata to fetch the previous page of results.
When specified, returns results starting immediately after the item identified by this cursor. Use the cursor value from the previous response's metadata to fetch the next page of results.
Maximum number of items to return per page. Must be between 1 and 100. Defaults to 20 if not specified.
Required range:
1 <= x <= 100Response
Successful response.
⌘I

