1. Support
Handwrite Admin
  • Handwrite Regular Accounts
    • Schemas
      • Error
      • Principal
      • Role
      • Access
      • ContentType
      • Language
      • FileRef
      • Document
      • Tombstone
      • DocumentPage
      • CreateDocument
      • UpdateDocument
      • FileInfo
      • CommitUpload
      • Upload
      • DownloadLink
      • Extracted
      • ExtractionFailed
      • CommittedDocument
      • ExtractedDocument
      • SearchHit
      • SearchPage
      • Export
      • Permission
      • Share
      • ChangeRole
      • Invitation
      • Permissions
      • ReceivedInvitation
      • AcceptedInvitation
      • Me
      • WebhookEventType
      • Webhook
      • CreateWebhook
      • CreatedWebhook
      • WebhookDelivery
      • AudioFormat
      • Speech
      • WordTiming
      • SpeechMarks
      • AudioLink
      • Voice
      • Quota
      • SettingEntry
      • Settings
      • SettingsPatch
      • PatchedSettings
      • OAuthToken
      • OAuthError
  • Handwrite Team
    • Schemas
      • Error
      • Principal
      • Access
      • ContentType
      • Language
      • FileRef
      • Document
      • Tombstone
      • DocumentPage
      • OrgKind
      • OrgRole
      • Organisation
      • CreateOrganisation
      • RenameOrganisation
      • Member
      • AddMember
      • ChangeMember
      • InviteMember
      • OrgInvitation
      • ReceivedOrgInvitation
  • Handwrite Classroom
    • Schemas
      • Error
      • Principal
      • Access
      • ContentType
      • Language
      • FileRef
      • Document
      • Tombstone
      • DocumentPage
      • OrgKind
      • OrgRole
      • Organisation
      • CreateOrganisation
      • RenameOrganisation
      • Member
      • AddMember
      • ChangeMember
      • InviteMember
      • OrgInvitation
      • ReceivedOrgInvitation
  • Handwrite Admin
    • Start here — staff console
    • Admin API specification notes
    • Admin socket specification notes
    • Staff role and permission matrix
    • Staff workflows and architecture
    • Admin source and validation status
    • Customer accounts
      • README — GET /api/admin/accounts/{sub}/billing
      • README — GET /api/admin/accounts/{sub}/cloud/documents/{id}
      • README — GET /api/admin/accounts/{sub}/cloud/documents
      • README — POST /api/admin/accounts/{sub}/cloud/keys/{keyId}/revoke
      • README — GET /api/admin/accounts/{sub}/cloud/keys
      • README — GET /api/admin/accounts/{sub}/cloud/oauth
      • README — GET /api/admin/accounts/{sub}/cloud/orgs
      • README — GET /api/admin/accounts/{sub}/cloud/settings
      • README — GET /api/admin/accounts/{sub}/cloud/usage
      • README — GET /api/admin/accounts/{sub}/cloud/webhooks
      • README — POST /api/admin/accounts/{sub}/delete
      • README — POST /api/admin/accounts/{sub}/disable
      • README — POST /api/admin/accounts/{sub}/enable
      • README — POST /api/admin/accounts/{sub}/mfa-reset
      • README — POST /api/admin/accounts/{sub}/password-reset
      • README — POST /api/admin/accounts/{sub}/purge
      • README — POST /api/admin/accounts/{sub}/restore
      • README — GET /api/admin/accounts/{sub}
      • README — PATCH /api/admin/accounts/{sub}
      • README — POST /api/admin/accounts/{sub}/sign-out
      • README — GET /api/admin/accounts
      • GET /api/admin/accounts/{sub}/billing
      • GET /api/admin/accounts/{sub}/cloud/documents/{id}
      • GET /api/admin/accounts/{sub}/cloud/documents
      • POST /api/admin/accounts/{sub}/cloud/keys/{keyId}/revoke
      • GET /api/admin/accounts/{sub}/cloud/keys
      • GET /api/admin/accounts/{sub}/cloud/oauth
      • GET /api/admin/accounts/{sub}/cloud/orgs
      • GET /api/admin/accounts/{sub}/cloud/settings
      • GET /api/admin/accounts/{sub}/cloud/usage
      • GET /api/admin/accounts/{sub}/cloud/webhooks
      • POST /api/admin/accounts/{sub}/delete
      • POST /api/admin/accounts/{sub}/disable
      • POST /api/admin/accounts/{sub}/enable
      • POST /api/admin/accounts/{sub}/mfa-reset
      • POST /api/admin/accounts/{sub}/password-reset
      • POST /api/admin/accounts/{sub}/purge
      • POST /api/admin/accounts/{sub}/restore
      • GET /api/admin/accounts/{sub}
      • PATCH /api/admin/accounts/{sub}
      • POST /api/admin/accounts/{sub}/sign-out
      • GET /api/admin/accounts
    • Staff administration
      • README — POST /api/admin/admins/{sub}/password-reset
      • README — PATCH /api/admin/admins/{sub}
      • README — DELETE /api/admin/admins/{sub}/sessions
      • README — GET /api/admin/admins
      • README — POST /api/admin/admins
      • POST /api/admin/admins/{sub}/password-reset
      • PATCH /api/admin/admins/{sub}
      • DELETE /api/admin/admins/{sub}/sessions
      • GET /api/admin/admins
      • POST /api/admin/admins
    • Operations
      • README — GET /api/admin/alarms
      • README — GET /api/admin/audit
      • README — GET /api/admin/billing
      • README — GET /api/admin/config
      • README — PUT /api/admin/config
      • README — GET /api/admin/deletions
      • README — GET /api/admin/icloud/probe
      • README — POST /api/admin/jobs/rollup
      • README — GET /api/admin/me
      • README — GET /api/admin/overview
      • README — GET /api/admin/usage/accounts/{sub}
      • README — GET /api/admin/usage/orgs/{id}
      • README — GET /api/admin/usage/rollup
      • GET /api/admin/alarms
      • GET /api/admin/audit
      • GET /api/admin/billing
      • GET /api/admin/config
      • PUT /api/admin/config
      • GET /api/admin/deletions
      • GET /api/admin/icloud/probe
      • POST /api/admin/jobs/rollup
      • GET /api/admin/me
      • GET /api/admin/overview
      • GET /api/admin/usage/accounts/{sub}
      • GET /api/admin/usage/orgs/{id}
      • GET /api/admin/usage/rollup
    • Authentication
      • README — POST /api/admin/auth/challenge
      • README — POST /api/admin/auth/sign-in
      • README — POST /api/admin/auth/sign-out-all
      • README — POST /api/admin/auth/sign-out
      • README — POST /api/admin/auth/step-up
      • POST /api/admin/auth/challenge
      • POST /api/admin/auth/sign-in
      • POST /api/admin/auth/sign-out-all
      • POST /api/admin/auth/sign-out
      • POST /api/admin/auth/step-up
    • Staff webhooks
      • README — DELETE /api/admin/hooks/{id}
      • README — POST /api/admin/hooks/{id}/test
      • README — GET /api/admin/hooks
      • README — POST /api/admin/hooks
      • README — staff webhook delivery
      • DELETE /api/admin/hooks/{id}
      • POST /api/admin/hooks/{id}/test
      • GET /api/admin/hooks
      • POST /api/admin/hooks
    • Organisations
      • README — POST /api/admin/orgs/{id}/api-access
      • README — GET /api/admin/orgs/{id}/audit
      • README — GET /api/admin/orgs/{id}/members
      • README — GET /api/admin/orgs/{id}
      • README — GET /api/admin/orgs/{id}/usage
      • POST /api/admin/orgs/{id}/api-access
      • GET /api/admin/orgs/{id}/audit
      • GET /api/admin/orgs/{id}/members
      • GET /api/admin/orgs/{id}
      • GET /api/admin/orgs/{id}/usage
    • Schools
      • README — POST /api/admin/schools/{orgId}/close
      • README — GET /api/admin/schools/{orgId}
      • README — PATCH /api/admin/schools/{orgId}
      • README — GET /api/admin/schools
      • POST /api/admin/schools/{orgId}/close
      • GET /api/admin/schools/{orgId}
      • PATCH /api/admin/schools/{orgId}
      • GET /api/admin/schools
    • Sessions
      • README — DELETE /api/admin/sessions/{id}
      • README — GET /api/admin/sessions
      • DELETE /api/admin/sessions/{id}
      • GET /api/admin/sessions
    • Support
      • README — GET /api/admin/support/canned/{id}
      • README — PUT /api/admin/support/canned/{id}
      • README — DELETE /api/admin/support/canned/{id}
      • README — GET /api/admin/support/canned
      • README — POST /api/admin/support/canned
      • README — GET /api/admin/support/tickets/{id}/attachments/{n}
      • README — GET /api/admin/support/tickets/{id}/link
      • README — POST /api/admin/support/tickets/{id}/link
      • README — POST /api/admin/support/tickets/{id}/note
      • README — POST /api/admin/support/tickets/{id}/reply
      • README — GET /api/admin/support/tickets/{id}
      • README — PATCH /api/admin/support/tickets/{id}
      • README — POST /api/admin/support/tickets/{id}/school
      • README — POST /api/admin/support/tickets/{id}/spam
      • README — GET /api/admin/support/tickets
      • GET /api/admin/support/canned/{id}
        GET
      • PUT /api/admin/support/canned/{id}
        PUT
      • DELETE /api/admin/support/canned/{id}
        DELETE
      • GET /api/admin/support/canned
        GET
      • POST /api/admin/support/canned
        POST
      • GET /api/admin/support/tickets/{id}/attachments/{n}
        GET
      • GET /api/admin/support/tickets/{id}/link
        GET
      • POST /api/admin/support/tickets/{id}/link
        POST
      • POST /api/admin/support/tickets/{id}/note
        POST
      • POST /api/admin/support/tickets/{id}/reply
        POST
      • GET /api/admin/support/tickets/{id}
        GET
      • PATCH /api/admin/support/tickets/{id}
        PATCH
      • POST /api/admin/support/tickets/{id}/school
        POST
      • POST /api/admin/support/tickets/{id}/spam
        POST
      • GET /api/admin/support/tickets
        GET
    • Health
      • README — GET /api/health
      • GET /api/health
  1. Support

README — GET /api/admin/support/tickets/{id}/attachments/{n}

GET /api/admin/support/tickets/{id}/attachments/{n}#

GET /api/admin/support/tickets/:id/attachments/:n (support.read): a 5-minute presigned download URL for the thread's
nth attachment, served as Content-Disposition: attachment + octet-stream (never rendered in the console's origin).
Every download is audited (support.attachment.download, with the message id and size; not the file name).

Caller and authorization#

Staff cookie session; permission support.read.
This is the private staff console on https://admin.handwrites.io. A personal API key, organisation token, student login or isolated app-testing credential does not authenticate this route.

Request contract#

LocationNameRequiredMeaning
pathidYesUse the ID from an authorized staff response; source validators reject malformed IDs.
pathnYesZero-based attachment index.
This operation does not define a JSON payload. Staff writes still require Content-Type: application/json and the session-bound CSRF header.

Response and failures#

Success: 200. GET /api/admin/support/tickets/:id/attachments/:n (support.read): a 5-minute presigned download URL for the thread's
nth attachment, served as Content-Disposition: attachment + octet-stream (never rendered in the console's origin).
Every download is audited (support.attachment.download, with the message id and size; not the file name).
The wrapper returns {error:{code,message}} for CloudError failures, attaches Request-Id, and disables caching. Handle 401 by signing in; show role refusal for 403 forbidden, reauthenticate only for step_up_required, and collect a reason for 400 reason_required. A CSRF failure needs a current page/session token, not blind retries. Operation-specific 404/409/413/422/502/503 errors retain their status. Honor Retry-After on 429.

Usage notes#

Keep customer messages and attachment URLs out of general logs. Replies can send real email; notes remain internal. Render inbound HTML only in the console’s sandboxed, network-restricted frame.

Implementation contract#

Source snapshot: admin/src/app/api/admin/support/tickets/[id]/attachments/[n]/route.ts. This reference describes the current working tree, not proof of deployment. The response service types and validators remain authoritative. The exact exported handler below makes conditional behavior reviewable. For helpers such as customer-routes or cloudRoute, see the shared API specification notes and the named service module.
/**
 * GET /api/admin/support/tickets/:id/attachments/:n (support.read): a 5-minute presigned download URL for the thread's
 * nth attachment, served as `Content-Disposition: attachment` + octet-stream (never rendered in the console's origin).
 * Every download is audited (support.attachment.download, with the message id and size; not the file name).
 */
export const GET = adminRoute("support.read", async (_request, ctx, { params }: Context) => {
  const { id: raw, n: index } = await params;
  const id = ticketIdParam(raw);
  if (!/^\d{1,5}$/.test(index)) throw notFound("Attachment");
  const { message, file } = await attachmentAt(id, Number(index));
  const url = await audited(ctx, {
    action: "support.attachment.download", targetType: "ticket", targetId: id,
    after: () => ({ messageId: message.id, n: Number(index), size: file.size, type: file.type }),
  }, () => attachmentDownloadUrl(file.key, file.name, EXPIRES));
  return adminJson({ url, expiresIn: EXPIRES, name: file.name });
});
Do not use production customer data to test this operation. Use an authorized staff test account and a disposable target in an appropriate environment; email, deletion, role and credential mutations have real effects.
Modified at 2026-10-26 13:41:16
Previous
README — POST /api/admin/support/canned
Next
README — GET /api/admin/support/tickets/{id}/link
Built with