SSpiderIQ
SSpiderIQ

Docs / api-reference/spidermail-attachments

SpiderMail Attachments

3 endpoints from the published OpenAPI import.

GET/api/v1/mail/attachments/{attachment_id}

Get Attachment Content

Retrieve attachment content by attachment ID.

This endpoint supports the three-layer progressive disclosure pattern:

  • Layer 1 (summary): LLM-generated summary (~100 tokens)
  • Layer 2 (preview): First 1500 characters of extracted text
  • Layer 3 (full): Complete extracted text content (default)

The attachment must belong to a mailbox owned by the authenticated client. Returns text/plain response for easy agent consumption.

Use this endpoint when an agent needs deeper analysis of an attachment that was summarized in the email payload.

Parameters

NameInTypeRequiredDescription
attachment_idpathstringtrue
layerqueryanyfalseContent layer to retrieve: 'summary' (Layer 1), 'preview' (Layer 2), or 'full' (Layer 3, default)
Try it
Query

Examples

cURL
curl -X GET 'https://spideriq.ai/api/v1/mail/attachments/{attachment_id}' \
  -H 'Authorization: Bearer <token>'
Python
import httpx

resp = httpx.get(
    "https://spideriq.ai/api/v1/mail/attachments/{attachment_id}",
    headers={"Authorization": "Bearer <token>"},
)
resp.raise_for_status()
print(resp.json())
JavaScript
const resp = await fetch("https://spideriq.ai/api/v1/mail/attachments/{attachment_id}", {
  method: "GET",
  headers: { "Authorization": "Bearer <token>" }
});
const data = await resp.json();
console.log(data);
Go
package main

import (
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://spideriq.ai/api/v1/mail/attachments/{attachment_id}", nil)
	req.Header.Set("Authorization", "Bearer <token>")
	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
}

Responses

StatusDescription
200Successful Response
422Validation Error
GET/api/v1/mail/attachments/by-key/{storage_key}

Get Attachment By Storage Key

Retrieve attachment content by storage key.

This is an alternative endpoint for agents that have the storage_key from the email payload's retrieve_key field.

The storage key must correspond to an attachment owned by the client.

Parameters

NameInTypeRequiredDescription
storage_keypathstringtrue
Try it
Query

Examples

cURL
curl -X GET 'https://spideriq.ai/api/v1/mail/attachments/by-key/{storage_key}' \
  -H 'Authorization: Bearer <token>'
Python
import httpx

resp = httpx.get(
    "https://spideriq.ai/api/v1/mail/attachments/by-key/{storage_key}",
    headers={"Authorization": "Bearer <token>"},
)
resp.raise_for_status()
print(resp.json())
JavaScript
const resp = await fetch("https://spideriq.ai/api/v1/mail/attachments/by-key/{storage_key}", {
  method: "GET",
  headers: { "Authorization": "Bearer <token>" }
});
const data = await resp.json();
console.log(data);
Go
package main

import (
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://spideriq.ai/api/v1/mail/attachments/by-key/{storage_key}", nil)
	req.Header.Set("Authorization", "Bearer <token>")
	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
}

Responses

StatusDescription
200Successful Response
422Validation Error
GET/api/v1/mail/attachments/message/{message_id}

List Message Attachments

List all attachments for a message.

Returns Layer 1 (summary) and Layer 2 (preview) for each attachment, along with metadata and retrieve keys for fetching full content.

Parameters

NameInTypeRequiredDescription
message_idpathintegertrue
Try it
Query

Examples

cURL
curl -X GET 'https://spideriq.ai/api/v1/mail/attachments/message/{message_id}' \
  -H 'Authorization: Bearer <token>'
Python
import httpx

resp = httpx.get(
    "https://spideriq.ai/api/v1/mail/attachments/message/{message_id}",
    headers={"Authorization": "Bearer <token>"},
)
resp.raise_for_status()
print(resp.json())
JavaScript
const resp = await fetch("https://spideriq.ai/api/v1/mail/attachments/message/{message_id}", {
  method: "GET",
  headers: { "Authorization": "Bearer <token>" }
});
const data = await resp.json();
console.log(data);
Go
package main

import (
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://spideriq.ai/api/v1/mail/attachments/message/{message_id}", nil)
	req.Header.Set("Authorization", "Bearer <token>")
	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
}

Responses

StatusDescription
200Successful Response
422Validation Error