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

# Create file

> Create a file record and get a signed upload URL.

Create a file record and receive a signed URL to upload the file directly to cloud storage.

## Upload flow

1. Call `POST /files` with the filename and content type
2. Upload the file to the returned `upload_url` using a `PUT` request
3. The file status transitions from `awaiting_upload` to `processing` automatically
4. Once processed, the file's text content is extracted and indexed

```bash theme={null}
# Step 1: Create the file record
curl -X POST https://api.bedrock.cv/files \
  -H "Authorization: Bearer sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{"project_id": "prj_01JABCD123", "filename": "specs.pdf", "content_type": "application/pdf"}'

# Step 2: Upload to the signed URL
curl -X PUT "https://storage.bedrock.cv/uploads/fil_01JABCD123?signature=..." \
  -H "Content-Type: application/pdf" \
  --data-binary @specs.pdf
```

<Note>
  The signed upload URL expires after 15 minutes. If it expires, create a new file record.
</Note>


## OpenAPI

````yaml POST /files
openapi: 3.1.0
info:
  title: Bedrock API
  version: 1.0.0
  description: >-
    REST API for construction document management and computer vision
    intelligence.
  contact:
    name: Bedrock Support
    url: https://bedrock.cv
    email: support@bedrock.cv
servers:
  - url: https://api.bedrock.cv
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /files:
    post:
      tags:
        - CMS
      summary: Create file upload
      description: Generate a signed upload URL for a new file.
      operationId: createFile
      parameters:
        - $ref: '#/components/parameters/ApiVersionHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFileRequest'
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/FileUpload'
              example:
                data:
                  id: projects%2Fprj_01JABCD123%2Ffiles%2Fsite-photo.jpg
                  upload_url: >-
                    https://storage.googleapis.com/bedrock-files/projects/prj_01JABCD123/files/site-photo.jpg?X-Goog-Signature=...
                  key: projects/prj_01JABCD123/files/site-photo.jpg
                  filename: site-photo.jpg
                  content_type: image/jpeg
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    ApiVersionHeader:
      name: X-API-Version
      in: header
      required: false
      schema:
        type: string
        default: '2026-01-01'
      description: API version
  schemas:
    CreateFileRequest:
      type: object
      properties:
        project_id:
          type: string
        filename:
          type: string
        content_type:
          type: string
          enum:
            - application/pdf
            - image/png
            - image/jpeg
            - image/tiff
      required:
        - project_id
        - filename
        - content_type
      example:
        project_id: prj_01JABCD123
        filename: site-photo.jpg
        content_type: image/jpeg
    FileUpload:
      type: object
      properties:
        id:
          type: string
        upload_url:
          type: string
          format: uri
        key:
          type: string
        filename:
          type: string
        content_type:
          type: string
      required:
        - id
        - upload_url
        - key
        - filename
        - content_type
      example:
        id: projects%2Fprj_01JABCD123%2Ffiles%2Fsite-photo.jpg
        upload_url: >-
          https://storage.googleapis.com/bedrock-files/projects/prj_01JABCD123/files/site-photo.jpg?X-Goog-Signature=...
        key: projects/prj_01JABCD123/files/site-photo.jpg
        filename: site-photo.jpg
        content_type: image/jpeg
    ApiError:
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        code:
          type: string
        request_id:
          type: string
        instance:
          type: string
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
      required:
        - type
        - title
        - status
        - detail
      example:
        type: https://docs.bedrock.cv/errors/bad-request
        title: Bad Request
        status: 400
        detail: One or more request fields are invalid.
        instance: /projects
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            type: https://docs.bedrock.cv/errors/bad-request
            title: Bad Request
            status: 400
            detail: One or more request fields are invalid.
            code: VALIDATION_ERROR
            request_id: req_01JABCD123
            errors:
              project_id:
                - Required field
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            type: https://docs.bedrock.cv/errors/authentication
            title: Unauthorized
            status: 401
            detail: Invalid or missing API key.
            code: UNAUTHORIZED
            request_id: req_01JABCD123
    RateLimited:
      description: Rate limited
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            type: https://docs.bedrock.cv/errors/rate-limit
            title: Rate limited
            status: 429
            detail: Rate limit exceeded. Try again in 60 seconds.
            code: RATE_LIMITED
            request_id: req_01JABCD123
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'API key prefixed with `sk_`. Example: `Authorization: Bearer sk_xxx`'
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````