# Upload an image to a planet

`POST /planets/{planetId}/image`

Got a crazy good photo of a planet? Share it with the world!

Base URL: https://galaxy.scalar.com, https://void.scalar.com/

## Authorization

- bearerAuth: HTTP bearer
- basicAuth: HTTP basic
- apiKeyQuery: API key in query `api_key`
- apiKeyHeader: API key in header `X-API-Key`
- apiKeyCookie: API key in cookie `api_key`
- oAuth2: oauth2
- openIdConnect: openIdConnect

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `planetId` | path | integer | yes | The ID of the planet to get |

## Request body (multipart/form-data)

Image to upload

- `image` (string): The image file to upload

Example:

```json
{
  "image": "@mars.jpg"
}
```

## Responses

### 200: Image uploaded

Returns `ImageUploadedMessage`.

- `message` (string)
- `imageUrl` (string): The URL where the uploaded image can be accessed
- `uploadedAt` (string): Timestamp when the image was uploaded
- `fileSize` (integer): Size of the uploaded image in bytes
- `mimeType` (string): The content type of the uploaded image

```json
{
  "message": "Image uploaded successfully",
  "imageUrl": "https://cdn.scalar.com/images/8f47c132-9d1f-4f83-b5a4-91db5ee757ab.jpg",
  "uploadedAt": "2024-01-15T14:30:00.000Z",
  "fileSize": 1048576,
  "mimeType": "image/jpeg"
}
```

### 400: Bad Request

Returns `BadRequestError`.

- `type` (string)
- `title` (string)
- `status` (integer)
- `detail` (string)

```json
{
  "type": "https://example.com/errors/bad-request",
  "title": "Bad Request",
  "status": 400,
  "detail": "The request was invalid."
}
```

### 403: Forbidden

Returns `ForbiddenError`.

- `type` (string)
- `title` (string)
- `status` (integer)
- `detail` (string)

```json
{
  "type": "https://example.com/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "You are not authorized to access this resource."
}
```

### 404: Not Found

Returns `NotFoundError`.

- `type` (string)
- `title` (string)
- `status` (integer)
- `detail` (string)

```json
{
  "type": "https://example.com/errors/not-found",
  "title": "Not Found",
  "status": 404,
  "detail": "The resource you are trying to access does not exist."
}
```

## Example request

```bash
curl -X POST 'https://galaxy.scalar.com/planets/{planetId}/image' \
  -H 'Authorization: Basic <base64-credentials>' \
  -H 'X-API-Key: <X-API-Key>' \
  -H 'Content-Type: application/json' \
  -d '{
  "image": "@mars.jpg"
}'
```
