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

# Create a code upload

> Somewhere to send a job's code: answers a signed URL to PUT a tar.gz of at most 1 GB. Then submit a job with `code: { upload_id }`; the code is unpacked into `/workspace/code` before the command starts, and the command runs there. An upload belongs to the caller's environment. Unused, it is deleted after 24 hours; a job using it keeps it 7 days. A workspace holds at most 50 uploads and 10 GB of them across its environments, and creates at most 60 an hour: past either the answer is 429. With no credit it is 402. The same `sha256` and `bytes` again answer the same upload.



## OpenAPI

````yaml /api-reference/openapi.json post /jobs/uploads
openapi: 3.1.0
info:
  title: Runcrate API
  version: 1.0.0
  summary: OpenAI-compatible inference API + GPU infrastructure API.
  description: >-
    Runcrate exposes two API surfaces. The inference API at
    `https://api.runcrate.ai/v1` is OpenAI-compatible: it accepts the standard
    OpenAI SDK with the base URL changed. The infrastructure API at
    `https://www.runcrate.ai/api/v1` manages GPU instances, jobs, persistent
    volumes, environments, SSH keys, templates, and billing. Both share a single
    `rc_live_*` API key.


    Pricing is per-token, per-image, per-second, or per-minute on the inference
    API (varies by model; see https://www.runcrate.ai/api/models/catalog for
    live rates) and per-second on GPU rentals (see
    https://www.runcrate.ai/pricing for hourly rates per GPU class).


    All infrastructure API responses are wrapped in `{ "data": ... }`. List
    responses also include a `meta` object with pagination cursors. Error
    responses use `{ "error": { "code": "...", "message": "..." } }`.
  termsOfService: https://www.runcrate.ai/terms
  contact:
    name: Runcrate
    url: https://www.runcrate.ai/contact
  license:
    name: Proprietary
    url: https://www.runcrate.ai/terms
servers:
  - url: https://api.runcrate.ai/v1
    description: Inference API (OpenAI-compatible)
  - url: https://www.runcrate.ai/api/v1
    description: >-
      Infrastructure API (instances, jobs, storage, environments, ssh-keys,
      templates, billing)
security:
  - ApiKeyAuth: []
tags:
  - name: Chat
    description: OpenAI-compatible chat completions.
  - name: Images
    description: Text-to-image generation.
  - name: Videos
    description: Async text-to-video and image-to-video generation.
  - name: Audio
    description: Text-to-speech and speech-to-text.
  - name: Embeddings
    description: Vector embeddings for RAG and search.
  - name: Models
    description: Model catalog discovery.
  - name: Instances
    description: GPU instance lifecycle.
  - name: Jobs
    description: >-
      Run one command on its own GPU machine. The machine stops, and billing
      ends, when the command exits.
  - name: Schedules
    description: >-
      Start an instance or a job later: once at a set time, or on a repeating
      cron schedule in your timezone.
  - name: Storage
    description: Persistent volume management.
  - name: Environments
    description: Resource isolation containers within a workspace.
  - name: Secrets
    description: >-
      Names of the secrets an environment's machines get. Values are set in the
      dashboard and never returned.
  - name: SSH Keys
    description: SSH key management for instance access.
  - name: Templates
    description: Pre-built instance images and configurations.
  - name: Billing
    description: Credit balance, transactions, usage metrics.
paths:
  /jobs/uploads:
    servers:
      - url: https://www.runcrate.ai/api/v1
    post:
      tags:
        - Jobs
      summary: Create a code upload
      description: >-
        Somewhere to send a job's code: answers a signed URL to PUT a tar.gz of
        at most 1 GB. Then submit a job with `code: { upload_id }`; the code is
        unpacked into `/workspace/code` before the command starts, and the
        command runs there. An upload belongs to the caller's environment.
        Unused, it is deleted after 24 hours; a job using it keeps it 7 days. A
        workspace holds at most 50 uploads and 10 GB of them across its
        environments, and creates at most 60 an hour: past either the answer is
        429. With no credit it is 402. The same `sha256` and `bytes` again
        answer the same upload.
      operationId: createJobUpload
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - bytes
              properties:
                bytes:
                  type: integer
                  minimum: 1
                  maximum: 1073741824
                  description: Size of the tar.gz you will upload.
                sha256:
                  type: string
                  pattern: ^[0-9a-f]{64}$
                  description: >-
                    SHA-256 of the tar.gz: the same hash and size again answer
                    the same upload.
      responses:
        '201':
          description: The upload.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/JobUpload'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: Could not prepare the upload; retry.
components:
  schemas:
    JobUpload:
      type: object
      required:
        - upload_id
        - url
        - url_expires_at
        - expires_at
        - max_bytes
      properties:
        upload_id:
          type: string
          format: uuid
          description: Pass as `code.upload_id` when you submit the job.
        url:
          type:
            - string
            - 'null'
          description: >-
            PUT the tar.gz here, before `url_expires_at`. No other headers are
            needed. null when this upload was already sent or a job uses it (the
            same `sha256` again): there is nothing to send.
        url_expires_at:
          type: string
          format: date-time
        expires_at:
          type: string
          format: date-time
          description: >-
            Jobs can use the upload until then (24 hours, then 7 days once a job
            uses it); it is deleted after.
        max_bytes:
          type: integer
          description: 1073741824 (1 GB).
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: >-
                Machine-readable error code (e.g. `validation_error`,
                `unauthorized`, `not_found`, `insufficient_credits`,
                `rate_limited`, `internal_error`).
            message:
              type: string
              description: Human-readable error message.
            details:
              type: object
              additionalProperties: true
              description: Optional structured error context.
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PaymentRequired:
      description: >-
        Insufficient credits, or the environment has reached its monthly budget
        (error code `BUDGET_REACHED`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationError:
      description: Request shape or values failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limited. Retry with exponential backoff.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: >-
        Use a Runcrate API key with the `rc_live_*` prefix as the bearer token.
        Create one at https://www.runcrate.ai/dashboard/api-keys.

````

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