The outcome

Use files, image, video, or voice features without creating permanent public links, orphaned assets, rights violations, or inaccessible ZDR-dependent workflows.

xAI API is a developer platform for Grok text, reasoning, vision, image, video, voice, realtime, retrieval, and tool-using applications. Building Grok-powered text, coding, reasoning, multimodal, media, realtime voice, retrieval, and tool-using applications through production APIs. This guide narrows that broad capability into one repeatable outcome, with checkpoints that keep the source material and your judgment in the loop.

Before you begin

Set the boundary before the tool starts.

Choose one real task, identify who will use the result, and decide what evidence or test will make the result acceptable. Gather only the source material needed for that task. If the work contains confidential, personal, regulated, or client-owned information, confirm that the platform and account are approved before sharing it.

Troiana principle

AI should make the work easier to inspect. If the workflow removes the source, the owner, or the review step, redesign the workflow.

Step by step

A workflow you can repeat.

  1. 01

    Define allowed media, source rights and consent, prohibited content, data classes, storage mode, audience, public-sharing rules, TTL, moderation, provenance, accessibility, and deletion owner.

  2. 02

    Confirm that the team's retention mode supports the chosen file or media feature, use a dedicated server key, keep uploads private by default, set the shortest useful expiration, and validate type and size.

  3. 03

    Sanitize filenames and metadata, isolate untrusted attachments, constrain generation parameters, request base64 or customer-controlled upload under ZDR, and never treat generated media as proof of an event.

  4. 04

    Review content policy, likeness and intellectual-property risks, hidden sensitive material, prompt injection, quality, captions, and intended audience before creating any public URL or publishing output.

  5. 05

    Inventory file IDs, output locations and public URLs, revoke links independently, delete underlying assets when finished, verify expiry, rotate exposed keys, and retain only approved provenance records.

Working standard

What good use looks like.

  • Keep assets private by default.
  • Expire both links and underlying files.
  • Verify feature compatibility with ZDR.

By default, xAI says API requests and responses are encrypted at rest and retained for 30 days for abuse auditing, though not used for training without explicit permission. Team-wide Zero Data Retention prevents prompt and output persistence but disables or changes stored Responses, Files, Collections, Batch, deferred, media, and voice-history features. Keep keys server-side, verify the response retention header, minimize data, set storage deliberately, authorize tools outside the model, expire or delete files and public URLs, and never expose model-selected actions directly.

Official references

Check the current product documentation.

Features, plan limits, availability, and data controls change. These official pages are the starting points used for this collection.