Zoho: Upload an Attachment
Zoho attachments.uploadAttachment: arguments, response, policy and SDK examples.
← Attachments operations · Get started
Operation zoho.uploadattachment
Provider route: POST /crm/v8/{moduleApiName}/{recordId}/Attachments. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/zoho with npm, or alter-sdk-zoho with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { ZohoIntegration } from "@alter-ai/zoho";
async function execute(input: Parameters<ZohoIntegration["attachments"]["uploadAttachment"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new ZohoIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.attachments.uploadAttachment(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_zoho import ZohoIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = ZohoIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.attachments.upload_attachment(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.recordId | string | Required within parent | Maximum length: 64 |
path.moduleApiName | string | Required within parent | Maximum length: 64 |
body | JSON | Required within parent | Schema used by uploadAttachment. |
body (anyOf 1) | object | Alternative | Upload attachment by file Additional keys: not allowed |
body (anyOf 1).file | object | Required within parent | The file to upload as an attachment Additional keys: not allowed |
body (anyOf 1).file.filename | string | Required within parent | Minimum length: 1 |
body (anyOf 1).file.content_type | string | Required within parent | Minimum length: 1 |
body (anyOf 1).file.content_base64 | string | Required within parent | |
body (anyOf 2) | object | Alternative | Upload attachment by URL Additional keys: not allowed |
body (anyOf 2).attachmentUrl | string | Required within parent | The URL of the attachment to be linked Maximum length: 3000 |
body (anyOf 2).title | string or null | Optional | Optional title for the attachment Maximum length: 255 Minimum length: 1 |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Upload an Attachment — response body |
Referenced models: Upload an Attachment — response body
Schemas
Section titled “Schemas”Upload an Attachment — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Successful attachment operation response Additional keys: not allowed |
data | array | Required within parent | Array of upload results Maximum items: 100 |
data[] | object | Each item | Upload status details Additional keys: not allowed |
data[].code | string | Required within parent | Represents the response code Known values: SUCCESS |
data[].details | Model | Required within parent | Expand Upload an Attachment — response body — data item details |
data[].message | string | Required within parent | Represents the success message Known values: attachment uploaded successfully |
data[].status | string | Required within parent | Represents the operation status Known values: success |
Referenced models: Upload an Attachment — response body — data item details
Upload an Attachment — response body — data item details
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Details of the uploaded attachment Additional keys: not allowed |
Created_By | object | Required within parent | Represents the user who created the attachment Additional keys: not allowed |
Created_By.id | string | Required within parent | User ID. Use the [Users API](users.yaml#$.paths./users/bulk.get) to retrieve user IDs. Maximum length: 50 Pattern: ^[0-9]+$ |
Created_By.name | string | Required within parent | Represents the user display name Maximum length: 250 |
Created_Time | string | Required within parent | Represents the creation timestamp Format: date-time |
Modified_By | object | Required within parent | Represents the user who last modified the attachment Additional keys: not allowed |
Modified_By.id | string | Required within parent | Represents the user ID Maximum length: 50 Pattern: ^[0-9]+$ |
Modified_By.name | string | Required within parent | Represents the user display name Maximum length: 250 |
Modified_Time | string | Required within parent | Represents the last modification timestamp Format: date-time |
id | string | Required within parent | Represents the attachment identifier Maximum length: 50 Pattern: ^[0-9]+$ |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: zoho.uploadattachment. Catalog operation: uploadAttachment. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.