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

# Create file

> Creates a file record as a link (`type=link`, `format=link`) — Lojou doesn't accept binary uploads through this endpoint, `path` must already be a reachable URL.



## OpenAPI

````yaml /openapi.yaml post /v1/files
openapi: 3.1.0
info:
  title: Lojou API
  version: 1.0.0
  description: |
    Official reference for the Lojou `/v1` API — everything a developer needs
    to create products, process orders, manage plans, and receive webhooks
    from a Lojou store.
servers:
  - url: https://api.lojou.app
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Health
  - name: OAuth
  - name: User
  - name: Products
  - name: Plans
  - name: Orders
  - name: Customers
  - name: Files
  - name: Webhooks
  - name: Discounts
  - name: Affiliates
paths:
  /v1/files:
    post:
      tags:
        - Files
      summary: Create file
      description: >-
        Creates a file record as a link (`type=link`, `format=link`) — Lojou
        doesn't accept binary uploads through this endpoint, `path` must already
        be a reachable URL.
      operationId: postV1Files
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFileRequest'
      responses:
        '201':
          description: File created
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                status: success
                message: File created successfully.
                file:
                  id: 43
                  name: Bônus - Checklist.pdf
                  path: https://cdn.lojou.app/lojou/stores/files/954/checklist.pdf
                  size: 0
                  type: link
                  format: link
                  is_active: true
                  created_at: '2026-08-31T16:20:00.000000Z'
                  updated_at: '2026-08-31T16:20:00.000000Z'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    CreateFileRequest:
      type: object
      required:
        - name
        - path
      properties:
        name:
          type: string
          example: Apostila do curso.pdf
        path:
          type: string
          description: File URL/path.
          example: https://cdn.lojou.app/lojou/stores/files/954/apostila.pdf
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
          example: error
        message:
          type: string
      additionalProperties: true
    ValidationErrorResponse:
      allOf:
        - $ref: '#/components/schemas/ErrorResponse'
        - type: object
          properties:
            errors:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
  responses:
    UnauthorizedError:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Unauthorized user.
    ForbiddenError:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: error
            message: Permission denied for this endpoint.
            error_code: insufficient_scope
            required_scopes:
              - orders.read
            missing_scopes:
              - orders.read
            granted_scopes:
              - products.read
              - products.write
    ValidationError:
      description: Validation failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
          example:
            status: error
            message: Validation failed.
            errors:
              amount:
                - The amount field is required.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        Send an API key or an OAuth access token in the `Authorization` header
        as a Bearer token. See [Authentication](/authentication) for details.

````