Literal AI icon

Literal AI

Use the Literal AI API

Overview

This node integrates with the Literal AI API to upload files and create attachments associated with threads. It is useful in scenarios where you want to programmatically add file content—such as documents, images, or other binary data—to a specific thread or conversation context within the Literal AI platform.

Practical examples include:

  • Uploading user-generated files to a discussion thread for collaborative review.
  • Attaching generated reports or analysis results to a project communication thread.
  • Automating the archival of files related to specific conversations or workflows.

Properties

Name Meaning
Binary Property The name of the binary property in the input data that contains the file's raw binary content.
Thread ID The identifier of the thread to which the file will be attached or uploaded.
Additional Fields Optional extra fields to customize the file upload, including:
- File ID: A custom identifier for the file.
- MIME Type: The MIME type of the file (e.g., image/png, application/pdf).
- Name: The filename to assign to the uploaded file.
- Metadata: Additional metadata as a JSON object to associate with the file.

Output

The node outputs a JSON object under the content field containing the response from the Literal AI API after uploading the file or creating the attachment. This typically includes details about the uploaded file such as its ID, URL, metadata, and any other relevant information returned by the API.

If the operation involves binary data, the node reads the binary content from the specified binary property but does not output binary data itself; instead, it returns metadata and confirmation of the upload.

Dependencies

  • Requires an API key credential for authenticating with the Literal AI API.
  • The node uses the official Literal AI client library (@literalai/client) to interact with the API.
  • The node expects the input data to contain binary data accessible via the specified binary property name.
  • Proper configuration of the API key credential in n8n is necessary for successful authentication.

Troubleshooting

  • Common Issues:

    • Specifying an incorrect binary property name will cause the node to fail to retrieve the file content.
    • Providing invalid JSON in the "Metadata" additional field can cause parsing errors.
    • Missing or invalid API key credentials will result in authentication failures.
    • Incorrect or empty Thread ID may lead to the file not being attached properly.
  • Error Messages and Resolutions:

    • "Cannot read binary data buffer" — Verify that the binary property name matches the actual binary data property in the input.
    • "Invalid JSON in metadata" — Ensure that the metadata field contains valid JSON syntax.
    • "Authentication failed" — Check that the API key credential is correctly set up and has the required permissions.
    • "Thread not found" — Confirm that the provided Thread ID exists and is accessible.

Links and References

Discussion