# Generate Texture

## Texture Generation

{% openapi src="<https://3170127470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fve7H9sNOF32Exg6OAhKo%2Fuploads%2Fgit-blob-37a7ab25a5bd5ce71dae46dea38154ce84cb4ffb%2Ftmp.yaml?alt=media>" path="/api/v2/rodin\_texture\_only" method="post" %}
[tmp.yaml](https://3170127470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fve7H9sNOF32Exg6OAhKo%2Fuploads%2Fgit-blob-37a7ab25a5bd5ce71dae46dea38154ce84cb4ffb%2Ftmp.yaml?alt=media)
{% endopenapi %}

## Texture Generation

Use this API to submit an asynchronous task to our server. You will get a task UUID from the API which can be used to [check the status ](https://developer.hyper3d.ai/api-specification/check-status_reset_v)of the the task and [download the result ](https://developer.hyper3d.ai/api-specification/download-results_reset_v)when the task is ready.

#### Pricing

Each call costs 0.5 credits.

#### Request

{% hint style="info" %}
**Note**: All requests to this endpoint must be sent using `multipart/form-data` to properly handle the file uploads and additional parameters required for the mesh and texture generation process.
{% endhint %}

**Authentication**

This API uses bearer key for authentication. You need to include a valid token in the `Authorization` header for all requests.

```
Authorization: Bearer RODIN_API_KEY
```

**Body**

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>image</td><td>file/Binary</td><td><strong>Required</strong>. One binary image file to serve as texture references.</td></tr><tr><td>prompt</td><td>string</td><td>Optional. A texture description to guide texture generation.</td></tr><tr><td>model</td><td>file/Binary</td><td><strong>Required</strong>. One binary 3D model file to process.<br>Maximum file size: <strong>10MB</strong></td></tr><tr><td>seed</td><td>number</td><td>Optional. A seed value for randomization in the mesh generation, ranging from 0 to 65535 (both inclusive). If not provided, the seed will be randomly generated.</td></tr><tr><td>reference_scale</td><td>number</td><td>Optional. Represents the reference scale of texture generation process.</td></tr><tr><td>geometry_file_format</td><td>string</td><td>Optional. The format of the output geometry file. Possible values are <code>glb</code>, <code>usdz</code>, <code>fbx</code>, <code>obj</code>, and <code>stl</code>. Default is <code>glb</code>.</td></tr><tr><td>material</td><td>string</td><td>Optional. The material type. Possible values are <code>PBR</code> and <code>Shaded</code>. Default is <code>PBR</code>..</td></tr><tr><td>resolution</td><td>string</td><td>Optional. The resolution of the output texture. Possible values are <code>Basic</code> and <code>High</code>. Default is <code>Basic</code>.</td></tr></tbody></table>

#### Examples

{% tabs %}
{% tab title="Request with cURL" %}

```bash
export RODIN_API_KEY="your api key"
curl https://api.hyper3d.com/api/v2/rodin_texture_only \
  -H "Authorization: Bearer ${RODIN_API_KEY}" \
  -F "image=@/path/to/your/image.jpg" \
  -F "model=@path/to/your/model.obj"  \
  -F "reference_scale=1.0" \
  -F "geometry_file_format=glb" \
  -F "material=PBR" \
  -F "resolution=High"
unset RODIN_API_KEY
```

{% endtab %}

{% tab title="Request with Python 3" %}

```python
import requests

# Constants
ENDPOINT = "https://api.hyper3d.com/api/v2/rodin_texture_only"
API_KEY = os.getenv("HYPER3D_API_KEY")
IMAGE_PATH = "/path/to/your/image.jpg"  # Replace with the path to your image
MODEL_PATH = "/path/to/your/model.obj"

# Prepare the headers
headers = {
    'Authorization': f'Bearer {API_KEY}',
}

# Prepare the form data
files = {
    'image': (os.path.basename(IMAGE_PATH), image_data, 'image/jpeg'),
    'model': (os.path.basename(MODEL_PATH), model_data, 'model/obj'),
    'reference_scale': (None, 1.0),
    'geometry_file_format': (None, 'glb'),
    'material': (None, PBR),
    'resolution': (None, 'High'),
}

# Make the POST request
response = requests.post(ENDPOINT, headers=headers, files=files)

# Parse and return the JSON response
print(response.json())

```

{% endtab %}

{% tab title="Response" %}

```json
{
  "error": null,
  "message": "Submitted.",
  "uuid": "123e4567-e89b-12d3-a456-426614174000",
  "jobs": {
      "uuids": ["job-uuid-1", "job-uuid-2"],
      "subscription_key": "sub-key-1"
  }
}
```

{% endtab %}
{% endtabs %}


---

# 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://developer.hyper3d.ai/api-specification/generate-texture_reset_v.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.
