> ## Documentation Index
> Fetch the complete documentation index at: https://onextel-09023014.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload media

> Upload an image, video or file to attach to templates.

```bash cURL theme={null}
curl -X POST https://truecaller.udchowdhury.me/v1/media \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/pdf" \
  -H "x-file-name: invoice.pdf" \
  --data-binary @invoice.pdf
```

Put the response's `url`, `mime_type` and `file_name` into a template's `media`. You can also use
any public https link instead of uploading.


## OpenAPI

````yaml api-reference/truecaller/openapi.yaml POST /v1/media
openapi: 3.1.0
info:
  title: OneXtel Truecaller Business Messaging API
  version: 1.0.0
  description: >
    Send verified business messages to Truecaller users: single messages,
    templates with

    personalisation, images, files and buttons, and campaigns to contact lists.


    Every request carries a workspace API key in the `x-api-key` header. Create
    one in the

    Truecaller campaigns portal under **Developers → API keys**.


    Errors are JSON with a single `error` string (and `details` for validation
    errors):


    ```json

    { "error": "invalid phone number" }

    ```
servers:
  - url: https://truecaller.udchowdhury.me
    description: Production
security:
  - apiKey: []
tags:
  - name: Messages
    description: Send one message and read its status.
  - name: Templates
    description: Reusable messages with variables, media and buttons.
  - name: Media
    description: Upload files to attach to templates.
  - name: Contact lists
    description: Audiences for campaigns.
  - name: Campaigns
    description: Send a template to a whole contact list, now or later.
  - name: Senders
    description: The verified business profiles your workspace sends from.
paths:
  /v1/media:
    post:
      tags:
        - Media
      summary: Upload media
      description: >
        Uploads one file to attach to templates. Send the raw file as the
        request body with its

        `Content-Type`, and its name in `x-file-name` (URL-encoded). Up to 20
        MB. The returned

        `url`, `mime_type` and `file_name` go straight into a template's
        `media`.
      operationId: uploadMedia
      parameters:
        - in: header
          name: x-file-name
          schema:
            type: string
          description: File name, URL-encoded, e.g. `invoice.pdf`.
          example: invoice.pdf
      requestBody:
        required: true
        content:
          image/jpeg:
            schema:
              type: string
              format: binary
          image/png:
            schema:
              type: string
              format: binary
          image/gif:
            schema:
              type: string
              format: binary
          video/mp4:
            schema:
              type: string
              format: binary
          video/quicktime:
            schema:
              type: string
              format: binary
          application/pdf:
            schema:
              type: string
              format: binary
          text/plain:
            schema:
              type: string
              format: binary
      responses:
        '201':
          description: Stored. Use these fields as a template's `media`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  url:
                    type: string
                    example: https://truecaller.udchowdhury.me/m/1c9e…/invoice.pdf
                  mime_type:
                    type: string
                    example: application/pdf
                  file_name:
                    type: string
                    example: invoice.pdf
                  size:
                    type: integer
                    example: 48213
        '415':
          description: Unsupported file type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
        details:
          type: array
          items:
            type: object
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Workspace API key from **Developers → API keys**. It starts with
        `tc_live_`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.