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

# Create upload URL

> Creates a signed upload URL in the `social-media` storage bucket and returns a `media_id` you can use later when creating posts. Upload the raw file bytes to `data.upload.signedUrl` with `PUT`; do not open that URL in a browser.



## OpenAPI

````yaml /openapi/public-api.yaml post /v1/media/uploads
openapi: 3.1.0
info:
  title: PostOnce Public API
  version: 1.0.0-alpha
  description: Public API for PostOnce paid users
servers:
  - url: https://postonce.to/api/public
security:
  - bearerAuth: []
paths:
  /v1/media/uploads:
    post:
      summary: Create upload URL
      description: >-
        Creates a signed upload URL in the `social-media` storage bucket and
        returns a `media_id` you can use later when creating posts. Upload the
        raw file bytes to `data.upload.signedUrl` with `PUT`; do not open that
        URL in a browser.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - filename
                - content_type
              properties:
                filename:
                  type: string
                  description: Original file name including extension.
                  example: launch-image.png
                content_type:
                  type: string
                  description: MIME type of the file being uploaded.
                  enum:
                    - image/jpeg
                    - image/png
                    - image/webp
                    - video/mp4
                    - video/quicktime
                    - video/webm
                  example: image/png
            examples:
              image:
                value:
                  filename: launch-image.png
                  content_type: image/png
              video:
                value:
                  filename: teaser.mp4
                  content_type: video/mp4
      responses:
        '201':
          description: Signed upload URL created successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      content_type:
                        type: string
                        enum:
                          - image/jpeg
                          - image/png
                          - image/webp
                          - video/mp4
                          - video/quicktime
                          - video/webm
                        example: image/png
                      media_id:
                        type: string
                        example: >-
                          cHVibGljLWFwaS91c2VyLTEyMy8xNzQzNDM0NTY3LWxhdW5jaC1pbWFnZS5wbmc
                      path:
                        type: string
                        example: public-api/user-123/1743434567-launch-image.png
                      upload:
                        type: object
                        properties:
                          path:
                            type: string
                            example: public-api/user-123/1743434567-launch-image.png
                          token:
                            type: string
                            example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
                          signedUrl:
                            type: string
                            example: >-
                              https://swgrcbzlaeshsmygubik.supabase.co/storage/v1/object/upload/sign/social-media/public-api/user-123/1743434567-launch-image.png?token=...
              examples:
                imageUpload:
                  value:
                    data:
                      content_type: image/png
                      media_id: >-
                        cHVibGljLWFwaS91c2VyLTEyMy8xNzQzNDM0NTY3LWxhdW5jaC1pbWFnZS5wbmc
                      path: public-api/user-123/1743434567-launch-image.png
                      upload:
                        path: public-api/user-123/1743434567-launch-image.png
                        token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
                        signedUrl: >-
                          https://swgrcbzlaeshsmygubik.supabase.co/storage/v1/object/upload/sign/social-media/public-api/user-123/1743434567-launch-image.png?token=...
        '400':
          description: Missing or invalid payload fields.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidFilename:
                  value:
                    error:
                      code: invalid_filename
                      message: filename is required.
        '401':
          description: Missing, invalid, revoked, or expired API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthErrorResponse'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: workflow_limit_reached
            message:
              type: string
              example: You have reached the maximum number of workflows for your plan.
    AuthErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: invalid_api_key
            message:
              type: string
              example: Invalid API key.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````