# OpenJourney API

### About

This powerful tool provides customizable styles, allowing users to choose from a variety of predefined visual styles or tailor the output to match specific branding guidelines. From minimalist elegance to vibrant expressiveness, the API offers flexibility in visual representation.

Users can seamlessly incorporate images, icons, and graphics to enhance the visual narrative and create impactful compositions that resonate with the audience. Additionally, the API supports multiple languages and character sets, ensuring global accessibility without compromising accuracy or quality.

Built on a robust and scalable infrastructure, the OpenJourney API delivers high-performance image generation capabilities, capable of handling large volumes of requests with minimal latency. It seamlessly integrates with existing applications and workflows through well-documented APIs and SDKs, making it easy to incorporate image generation functionality into a wide range of software solutions.

Applications of the OpenJourney API span diverse industries and use cases, including content creation, e-commerce, education and training, and data visualization. Whether it's generating eye-catching visuals for social media, creating product images for e-commerce, or transforming educational content into interactive presentations, the OpenJourney API empowers users to unleash the full potential of their textual content through visually stunning images.

#### Developer Portal:  <https://api.market/store/magicapi/openjourney>

![image](https://telegra.ph/file/8569c0ff5b15f5c734834.png)

### Curl Requests and Responses

**Process the API**

{% tabs %}
{% tab title="Curl" %}

```bash
curl -X 'POST' \
  'https://prod.api.market/api/v1/magicapi/openjourney/openjourney' \
  -H 'accept: application/json' \
  -H 'x-api-market-key: API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "width": 512,
  "height": 512,
  "prompt": "Yellow car in the garden",
  "scheduler": "DPMSolverMultistep",
  "num_outputs": 1,
  "guidance_scale": 7,
  "prompt_strength": 0.8,
  "num_inference_steps": 50
}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

headers = {
    'accept': 'application/json',
    'x-api-market-key': 'API_KEY',
    'Content-Type': 'application/json',
}

json_data = {
    'width': 512,
    'height': 512,
    'prompt': 'Yellow car in the garden',
    'scheduler': 'DPMSolverMultistep',
    'num_outputs': 1,
    'guidance_scale': 7,
    'prompt_strength': 0.8,
    'num_inference_steps': 50,
}

response = requests.post('https://prod.api.market/api/v1/magicapi/openjourney/openjourney', headers=headers, json=json_data)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://prod.api.market/api/v1/magicapi/openjourney/openjourney');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'accept: application/json',
    'x-api-market-key: API_KEY',
    'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n  \"width\": 512,\n  \"height\": 512,\n  \"prompt\": \"Yellow car in the garden\",\n  \"scheduler\": \"DPMSolverMultistep\",\n  \"num_outputs\": 1,\n  \"guidance_scale\": 7,\n  \"prompt_strength\": 0.8,\n  \"num_inference_steps\": 50\n}");

$response = curl_exec($ch);

curl_close($ch);
```

{% endtab %}

{% tab title="NodeJs" %}

```javascript
import axios from 'axios';

const response = await axios.post(
  'https://prod.api.market/api/v1/magicapi/openjourney/openjourney',
  {
    'width': 512,
    'height': 512,
    'prompt': 'Yellow car in the garden',
    'scheduler': 'DPMSolverMultistep',
    'num_outputs': 1,
    'guidance_scale': 7,
    'prompt_strength': 0.8,
    'num_inference_steps': 50
  },
  {
    headers: {
      'accept': 'application/json',
      'x-api-market-key': 'API_KEY',
      'Content-Type': 'application/json'
    }
  }
);
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
fetch('https://prod.api.market/api/v1/magicapi/openjourney/openjourney', {
  method: 'POST',
  headers: {
    'accept': 'application/json',
    'x-api-market-key': 'API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    'width': 512,
    'height': 512,
    'prompt': 'Yellow car in the garden',
    'scheduler': 'DPMSolverMultistep',
    'num_outputs': 1,
    'guidance_scale': 7,
    'prompt_strength': 0.8,
    'num_inference_steps': 50
  })
});
```

{% endtab %}
{% endtabs %}

```
{
  "request_id": REQUEST_ID
}
```

**Get the result**

{% tabs %}
{% tab title="Curl" %}

```bash
curl -X 'GET' \
  'https://prod.api.market/api/v1/magicapi/openjourney/predictions/REQUEST_ID' \
  -H 'accept: application/json' \
  -H 'x-api-market-key: API_KEY'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

headers = {
    'accept': 'application/json',
    'x-api-market-key': 'API_KEY',
}

response = requests.get('https://prod.api.market/api/v1/magicapi/openjourney/predictions/REQUEST_ID', headers=headers)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://prod.api.market/api/v1/magicapi/openjourney/predictions/REQUEST_ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'accept: application/json',
    'x-api-market-key: API_KEY',
]);

$response = curl_exec($ch);

curl_close($ch);
```

{% endtab %}

{% tab title="NodeJs" %}

```javascript
import axios from 'axios';

const response = await axios.get('https://prod.api.market/api/v1/magicapi/openjourney/predictions/REQUEST_ID', {
  headers: {
    'accept': 'application/json',
    'x-api-market-key': 'API_KEY'
  }
});
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
fetch('https://prod.api.market/api/v1/magicapi/openjourney/predictions/REQUEST_ID', {
  headers: {
    'accept': 'application/json',
    'x-api-market-key': 'API_KEY'
  }
});
```

{% endtab %}
{% endtabs %}

```json
{
  "status": "succeeded",
  "result": "RESULT_URL"
}
```


---

# 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.api.market/api-product-docs/magicapi/openjourney-api.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.
