Skip to main content
POST
/
inbox_messages
/
{inbox_message_id}
/
attachments
JavaScript
import fs from 'fs';
import Moonbase from '@moonbaseai/sdk';

const client = new Moonbase({
  apiKey: process.env['MOONBASE_API_KEY'], // This is the default and can be omitted
});

const messageAttachment = await client.inboxMessages.attachments.create('inbox_message_id');

console.log(messageAttachment.id);
{
  "id": "1CLJt2vAY2dWSPDQt8AQpz",
  "type": "message_attachment",
  "filename": "readme.txt",
  "size": 24,
  "download_url": "https://api.moonbase.ai/asset_redirects/1CLJt2vAY2dWSPDQt8AQpz?token=eyJfcmFpbHMiOnsiZGF0YSI6eyJpZCI6IjFDTEp0MnZBWTJkV1NQRFF0OEFRcHoiLCJibG9iX2lkIjoiMUNMSnQydkFIZVJ0WGZqNEJxNXBpRCIsImNyZWF0ZWRfYXQiOiIyMDI1LTAyLTE3VDE2OjAwOjAwLjAwMFoiLCJuYW1lIjoiYXR0YWNobWVudHMiLCJyZWNvcmRfaWQiOiIxQ0xKdDJ2NWFOZDhHNVNHekVhZVZVIiwicmVjb3JkX3R5cGUiOiJNZXNzYWdlIn0sImV4cCI6IjIwMjUtMDItMTdUMTc6MDA6MDAuMDAwWiIsInB1ciI6InJlZGlyZWN0In19--5d7d52ce87afcd22c2dd88a5a6b1c2822764b32b",
  "created_at": "2025-02-17T16:00:00.000Z"
}

Documentation Index

Fetch the complete documentation index at: https://docs.moonbase.ai/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Your Moonbase API key.

Path Parameters

inbox_message_id
string
required

The ID of the Message.

Body

file
file
file_id
string

Response

The Attachment object represents a file attached to a message. You can download the file content via the download_url.

type
string
required

String representing the object’s type. Always message_attachment for this object.

Allowed value: "message_attachment"
id
string
required

Unique identifier for the object.

filename
string
required

The original name of the uploaded file, including its extension.

size
integer
required

The size of the file in bytes.

download_url
string<uri>
required

A temporary, signed URL to download the file content. The URL expires after one hour.

created_at
string<date-time>
required

Time at which the object was created, as an ISO 8601 timestamp in UTC.