> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omnixapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Media

> Send an end-to-end encrypted media attachment (image / gif / video / file) into an established XChat conversation. Provide the file as `image_url` or `image_base64`. Requires your `encryption_code` (your XChat PIN — the code you set when enabling encrypted chats on X).



## OpenAPI

````yaml /api-reference/openapi.json post /dm/send_media
openapi: 3.1.0
info:
  title: OmniX API
  version: 1.0.0
  description: >-
    The fastest X (Twitter) API. Read and write tweets, users, lists, media and
    articles with a single API key. Every request runs as a real X account you
    supply via `auth_token`. Flat $0.001 per successful call.
servers:
  - url: https://api.omnixapi.com/api/v1/twitter
security:
  - bearerAuth: []
tags:
  - name: Tweets
    description: Search, read and write tweets.
  - name: Users
    description: Profiles, timelines, networks and profile actions.
  - name: Lists
    description: X List data.
  - name: Media
    description: Upload images, GIFs and video.
  - name: Articles
    description: Long-form X Articles.
  - name: Direct Messages
    description: >-
      Read and send X (XChat) direct messages. Encrypted operations require your
      `encryption_code` (XChat PIN).
  - name: Webhooks
    description: >-
      Real-time event delivery. Register an https URL and OmniX POSTs typed,
      signed events for DMs, mentions, replies, likes and follows.
  - name: Account
    description: >-
      Your OmniX account details, credit balance, usage and payment history.
      Free — no credits deducted, and no X account token required.
paths:
  /dm/send_media:
    post:
      tags:
        - Direct Messages
      summary: Send Media
      description: >-
        Send an end-to-end encrypted media attachment (image / gif / video /
        file) into an established XChat conversation. Provide the file as
        `image_url` or `image_base64`. Requires your `encryption_code` (your
        XChat PIN — the code you set when enabling encrypted chats on X).
      operationId: dmSendMedia
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - auth_token
                - encryption_code
                - conversation_id
              properties:
                auth_token:
                  $ref: '#/components/schemas/AuthTokenField'
                encryption_code:
                  $ref: '#/components/schemas/EncryptionCodeField'
                conversation_id:
                  type: string
                  example: '1000000000000000001:2000000000000000002'
                image_url:
                  type: string
                  description: >-
                    A URL to fetch the media from. Provide this or
                    `image_base64`.
                image_base64:
                  type: string
                  description: >-
                    Base64 of the file (with or without a `data:` prefix).
                    Provide this or `image_url`.
                text:
                  type: string
                  description: Optional caption.
                type:
                  type: integer
                  description: 1=image (default), 2=gif, 3=video, 4=audio, 5=file, 6=svg.
                  default: 1
                filename:
                  type: string
                width:
                  type: integer
                height:
                  type: integer
                proxy:
                  $ref: '#/components/schemas/ProxyField'
      responses:
        '200':
          description: Media sent.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Envelope'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          ok:
                            type: boolean
                          message_id:
                            type: string
                          conversation_id:
                            type: string
                          media_hash_key:
                            type: string
                          filename:
                            type: string
                          type:
                            type: integer
                          size:
                            type: integer
                          text:
                            type: string
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    AuthTokenField:
      type: string
      description: The X account `auth_token` cookie the action runs as.
      example: YOUR_X_AUTH_TOKEN
    EncryptionCodeField:
      type: string
      description: >-
        Your XChat **encryption code** — the PIN you set when enabling encrypted
        chats on X. Used to recover your key so messages can be decrypted and
        outgoing events signed.
      example: YOUR_XCHAT_PIN
    ProxyField:
      type: string
      description: >-
        Optional outbound proxy for this call (`http://` or `https://`,
        optionally `user:pass@host:port`). The X request runs through it —
        useful for geo-routing or spreading calls across IPs. SOCKS proxies are
        not supported.
      example: http://user:pass@host:8080
    Envelope:
      type: object
      properties:
        status:
          type: boolean
          example: true
        data:
          type: object
        error:
          type: string
          nullable: true
          example: null
    Error:
      type: object
      properties:
        status:
          type: boolean
          example: false
        data:
          type: object
          nullable: true
          example: null
        error:
          type: string
  responses:
    BadRequest:
      description: A required field is missing or malformed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: false
            data: null
            error: 'Missing required field: text'
    Forbidden:
      description: The X account isn't allowed to do this.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: false
            data: null
            error: You can only delete your own tweets
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your OmniX API key, e.g. `omnix_live_...`. Billed per call.

````