# Bilder

## Bild hochladen

<mark style="color:green;">`POST`</mark> `https://api.propstack.de/v1/images`

Endpoint zum Hochladen eines Bildes. Ein Bild gehört immer entweder zu einem Projekt oder zu einem Objekt. Die Bilder-Parameter müssen um ein `image` Objekt umschlossen werden.

#### Request Body

| Name            | Type    | Description                                                                                            |
| --------------- | ------- | ------------------------------------------------------------------------------------------------------ |
| photo           | string  | base64 encoded String für das Bild                                                                     |
| imageable\_id   | integer | ID des Objektes/Projektes                                                                              |
| imageable\_type | string  | Entweder "Property" oder "Project", je nachdem ob das Bild an ein Objekt oder Projekt angehangen wird. |
| is\_private     | boolean | Wenn `false` => Bild auf Portale anzeigen. Bei `true` => Bild wird nicht zu Portalen übertragen        |
| title           | string  | Bildbeschreibung. Wird auch als Dateiname in der URL verwendet                                         |

{% tabs %}
{% tab title="201 Bild erfolgreich erstellt. ID des Bildes wird zurückgegeben." %}

```javascript
{
  "ok": true,
  "id": 38202
}
```

{% endtab %}
{% endtabs %}

### Beispiel Payload

```javascript
{
  "image": {
    "imageable_id": 12,
    "imageable_type": "Property",
    "photo": "data:image/png;base64,...",
    "title": "Ausblick"
  }
}
```

## Bild bearbeiten

<mark style="color:orange;">`PUT`</mark> `https://api.propstack.de/v1/images/{id}`

#### Request Body

| Name        | Type   | Description                                                                                     |
| ----------- | ------ | ----------------------------------------------------------------------------------------------- |
| title       | String | Bildbeschreibung                                                                                |
| is\_private | String | Wenn `false` => Bild auf Portale anzeigen. Bei `true` => Bild wird nicht zu Portalen übertragen |

### Bild-Beschreibung mehrsprachig bearbeiten

Die Bildbeschreibung ist ein mehrsprachiges Feld, d.h. man kann es in verschiedenen Sprachen befüllen. Über die API geht das, indem man das Feld `title_[locale]` bedient. \[locale] muss mit der jeweiligen Sprache ersetzt werden. Ein Beispiel-Payload um die deutsche und englische Version gleichzeitig zu setzen:

```
{
  "image": {
    "title_de": "Ausblick",
    "title_en": "View"
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.propstack.de/reference/objekte/bilder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
