# Robots_PrepareRobotModelImport

`POST /v1/accounts/{account}/robots/{robot}/model:prepareImport`

Starts a model import: returns a short-lived signed URL to PUT the file
to, and the object reference ImportRobotModel then takes. Nothing changes
until the import.

- Base URL: `https://junction-api.qualiastudios.dev`
- Authentication: an API key in the `X-API-Key` header

## Parameters

- `account` (path, string, required): The account id.
- `robot` (path, string, required): The robot id.

## Request body

Required: `application/json` `qualia.v1.PrepareRobotModelImportRequest`

## Responses

- `200` OK: `application/json` `qualia.v1.PrepareRobotModelImportResponse`
- `default` Default error response: `application/json` `google.rpc.Status`

## Schemas

```yaml
qualia.v1.PrepareRobotModelImportRequest:
  required:
    - name
    - filename
    - sizeBytes
  type: object
  properties:
    name:
      type: string
      description: accounts/{account}/robots/{robot}/model
    filename:
      type: string
      description: |-
        The file name it was picked as, e.g. "openarm_v20.urdf" or "rizon.zip":
        the URDF alone, or a .zip of the URDF and its meshes (the package
        directory).
    sizeBytes:
      type: string
      description: |-
        Its size in bytes; at most 256 MiB (268435456), else INVALID_ARGUMENT.
        The bucket refuses uploads over 256 MiB, and ImportRobotModel refuses an
        upload whose stored size differs from this one.
  description: Request for Robots.PrepareRobotModelImport.
qualia.v1.PrepareRobotModelImportResponse:
  type: object
  properties:
    uploadUri:
      type: string
      description: |-
        Signed URL to PUT the file to, valid for 2 hours (the lifetime Supabase
        Storage fixes for signed upload URLs).
    object:
      type: string
      description: The object reference to pass to ImportRobotModel.
    expireTime:
      type: string
      description: When upload_uri stops working.
      format: date-time
  description: Response for Robots.PrepareRobotModelImport.
google.rpc.Status:
  oneOf:
    - $ref: "#/components/schemas/ApiError"
    - $ref: "#/components/schemas/GatewayError"
  description: "The body of a failed call: one of the two shapes below."
ApiError:
  title: API error
  type: object
  required:
    - code
    - message
    - retryable
    - details
  properties:
    code:
      type: string
      description: The gRPC code name in upper case, e.g. `NOT_FOUND`.
    message:
      type: string
    retryable:
      type: boolean
      description: Whether the same call may succeed if retried.
    details:
      type: array
      items:
        type: object
      description: "Empty, except when a dataset copy or move is refused: then one `google.rpc.ErrorInfo` with the refusal's `reason` code, its `domain` and, in `metadata`, the datasets it names."
  description: A refusal from the API itself.
GatewayError:
  title: Gateway error
  type: object
  required:
    - detail
  properties:
    detail:
      type: string
      description: What went wrong.
  description: A refusal from the gateway before the call reaches the API, for example `401` bad or missing API key, `403` key lacks the scope or environment closed, `413` body too large.
```
