Literal AI icon

Literal AI

Use the Literal AI API

Overview

This node integrates with the Literal AI API to create an attachment file linked to a specific thread. It uploads binary file data as an attachment, optionally associating it with metadata and other custom fields. This is useful in scenarios where you want to programmatically add files (such as images, documents, or any binary content) to conversations, projects, or workflows managed by Literal AI.

Practical examples include:

  • Attaching user-uploaded images or documents to a support ticket thread.
  • Adding generated reports or logs as attachments to project discussion threads.
  • Automating file uploads as part of a larger AI-driven workflow that manages conversations or data threads.

Properties

Name Meaning
Binary Property The name of the binary property from 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.
Additional Fields Optional extra fields for the file attachment:
- File ID: Custom identifier for the file.
- MIME Type: The file's MIME type.
- Name: The filename.
- Metadata: Additional JSON metadata related to the file.

Output

The node outputs a JSON object under the json field containing the response from the Literal AI API after creating the attachment. This typically includes details about the uploaded file such as its ID, name, MIME type, associated thread ID, and any metadata stored.

If the node processes multiple items, each output item corresponds to one attachment creation result.

The node does not output binary data itself; it only sends binary data as input and returns JSON metadata about the created attachment.

Dependencies

  • Requires an active Literal AI API key credential configured in n8n.
  • Uses the Literal AI client library (@literalai/client) to interact with the API.
  • The node expects the input binary data to be available in the specified binary property.

Troubleshooting

  • Missing or incorrect binary property: If the specified binary property does not exist or contains invalid data, the upload will fail. Ensure the binary property name matches exactly and contains valid binary content.
  • Invalid Thread ID: Providing an incorrect or non-existent thread ID may cause the API to reject the attachment. Verify the thread ID is correct and accessible.
  • Malformed metadata JSON: If additional metadata is provided, it must be valid JSON. Invalid JSON will cause parsing errors.
  • API authentication errors: Ensure the API key credential is correctly set up and has sufficient permissions.
  • Network or API errors: Temporary network issues or API downtime can cause failures. Retrying or checking API status may help.

Common error messages usually relate to invalid parameters, missing required fields, or authentication failures. Reviewing the error message returned in the node output helps identify the exact issue.

Links and References

Discussion