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

# Generating a Presentation

With the **SlidesGPT API**, you can create a presentation by sending a request with a prompt. The API will generate slides based on your input.

### Request Example

Send a `POST` request to:

```
https://api.slidesgpt.com/v1/presentations/generate
```

#### Sample Code (cURL)

```sh theme={null}
curl -X POST "https://api.slidesgpt.com/v1/presentations/generate" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"prompt": "Introduction to Machine Learning"}'
```

#### With Custom Template (Optional)

To use your own branded PowerPoint template, include a `templateId` in your request. Learn how to upload and manage custom templates in our [Custom Templates Guide](/getting-started/custom-templates).

```sh theme={null}
curl -X POST "https://api.slidesgpt.com/v1/presentations/generate" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
       "prompt": "Introduction to Machine Learning",
       "templateId": "YOUR_TEMPLATE_ID"
     }'
```

#### Sample Code (JavaScript)

```js theme={null}
async function generatePresentation(prompt, templateId = null) {
  const body = { prompt };
  if (templateId) body.templateId = templateId; // Add custom template ID

  const response = await fetch("https://api.slidesgpt.com/v1/presentations/generate", {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify(body)
  })
  return response.json();
}

// Generate with default theme
await generatePresentation("Introduction to Machine Learning");

// Generate with custom template
await generatePresentation("Q4 Business Review", "YOUR_TEMPLATE_ID");
```

> **Note:** You must include your API key in the `Authorization` header. If you don't have one, follow the steps in the [Authentication Guide](/getting-started/authentication) to get your API key.

> **Tip:** Want to use your company's branded templates? Check out our [Custom Templates Guide](/getting-started/custom-templates) to learn how to upload and use your own PowerPoint designs.

### Response Example

```json theme={null}
{
  "id": "123",
  "embed": "https://api.slidesgpt.com/123/embed",
  "download": "https://api.slidesgpt.com/123/download"
}
```

You can use the `embed` link to preview the presentation or download the PowerPoint file.
