> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wetrocloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Images

> Learn how to generate Markdown for images using Wetrocloud API

## How to Generate Markdown for Images

Make a `POST` request to the `/v2/markdown-converter/` endpoint with the required parameters in the body and make sure you use the `image` type.

<Note>
  To use the `image` type, the resource should be provided as URLs.
</Note>

### Request Example (File Path)

<CodeGroup>
  ```python Python theme={null}
  from wetro import Wetrocloud
      
  # Initialize the Wetrocloud client
  client = Wetrocloud(api_key="your_api_key")
      
  # Generate Markdown
  markdown_response = client.markdown_converter(
    link = "./image/zy69smzbjqtogtjlszki.jpg", # Replace with your actual file path
    resource_type = "image"
  )

  print(markdown_response)
  ```

  ```javascript JavaScript theme={null}
  import Wetrocloud from "wetro-sdk";

  // Initialize the Wetrocloud client
  const client = new Wetrocloud({
    apiKey: "your_api_key"
  });

  // Generate Markdown
  const response = await client.markDownConverter({
    resource: "./image/zy69smzbjqtogtjlszki.jpg", // Replace with your actual file path
    resource_type: "image"
  });

  console.log("converted to markdown", response);
  ```

  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.wetrocloud.com/v2/markdown-converter/ \
    --header 'Authorization: Token <api-key>' \
    --header 'Content-Type: application/json' \
    --data '{
      # File Paths are not accepted via cURL, therefore files must be provided as URL
      "resource": "https://res.cloudinary.com/dxcb59rb3/image/upload/v1747912102/zy69smzbjqtogtjlszki.jpg", 
      "type": "image"
    }'
  ```
</CodeGroup>

### Request Example (File as URL)

<CodeGroup>
  ```python Python theme={null}
  from wetro import Wetrocloud
      
  # Initialize the Wetrocloud client
  client = Wetrocloud(api_key="your_api_key")
      
  # Generate Markdown
  markdown_response = client.markdown_converter(
    link = "https://res.cloudinary.com/dxcb59rb3/image/upload/v1747912102/zy69smzbjqtogtjlszki.jpg",
    resource_type = "image"
  )

  print(markdown_response)
  ```

  ```javascript Javascript theme={null}
  import Wetrocloud from "wetro-sdk";

  // Initialize the Wetrocloud client
  const client = new Wetrocloud({
    apiKey: "your_api_key"
  });

  // Insert a file into a Collection
  const response = await client.markDownConverter({
    resource: "https://res.cloudinary.com/dxcb59rb3/image/upload/v1747912102/zy69smzbjqtogtjlszki.jpg", 
    resource_type:"image"
  });

  console.log("converted to markdown", response);
  ```

  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.wetrocloud.com/v2/markdown-converter/ \
    --header 'Authorization: Token <api-key>' \
    --header 'Content-Type: application/json' \
    --data '{
      "resource": "https://res.cloudinary.com/dxcb59rb3/image/upload/v1747912102/zy69smzbjqtogtjlszki.jpg", 
      "type": "image"
    }'
  ```
</CodeGroup>

### Successful Response

A successful response confirms the operation and tracks token usage.

**Example Response**

```json theme={null}
  {
      response: 'Certainly! Here is the extracted information from the image:\n\n---\n\n
      ### Summary of the Month (28/04/2025)
      \n\n- Activities carried out:
      \n  - Automation of the loan allocation process
      \n  - Business process automation of the compassionate loan process
      \n  - Attendance/representation at the SPE FORUM
      \n  - Field and office business process automation
      \n  - Car and compassionate loan demos
      \n  - Development of the car/compassionate loan team calculator tool
      \n\n- Challenges and solutions:
      \n  - Technical problems involved in building the application.
      \n\n- Additional notes:\n  - Automatic formatting (related to figures/calculations).
      \n\n- Calculations:\n  - \\( 8,000,000 \\times 4 = 12 \\,(10,000) \\)
      \n  - \\( 3,400,000 - 120,000 \\)\n  - \\( 3,200,000 - 120,000 \\)
      \n\n- Amounts mentioned:\n  - 4,000,000\n  - 10,000\n  - 120,000',
      tokens: 946,
      success: true
    }
```

| Field      | Description                                               |
| ---------- | --------------------------------------------------------- |
| `success`  | Indicates whether the resource was inserted successfully. |
| `tokens`   | Number of tokens consumed during the operation.           |
| `response` | Result for the markdown generation                        |

## Related Operations

* **[Create Collection](create)**: Start by creating a collection to hold your resources.
* **[Query Resources](query)**: Access and retrieve insights from the indexed resources.
* **[Delete Collection](delete)**: Remove collections and their resources when no longer needed.
