### List Themes using Python Source: https://developers.gamma.app/docs/workspace/list-themes Example of how to list themes using Python. This snippet shows how to make a GET request and handle the JSON response. ```python import requests headers = { "X-API-KEY": "YOUR_API_KEY" } response = requests.get("https://public-api.gamma.app/v1.0/themes", headers=headers) print(response.json()) ``` -------------------------------- ### Example Usage (Themes) Source: https://developers.gamma.app/docs/get-started/understanding-the-api-options Example of how to list available themes using curl. ```APIDOC ```bash curl https://public-api.gamma.app/v1.0/themes \ -H "X-API-KEY: $GAMMA_API_KEY" ``` ``` -------------------------------- ### Start and Poll for Generation (cURL) Source: https://developers.gamma.app/docs/guides/async-patterns-and-polling This cURL example shows how to initiate a generation task and then poll for its status using command-line tools. It includes steps for extracting the generation ID and checking the status in a loop. ```APIDOC ## Start and Poll for Generation (cURL) ### Description This example demonstrates how to start a generation task using cURL and then poll for its completion status in a loop. It utilizes `jq` for parsing JSON responses. ### Method POST, GET ### Endpoint - POST `https://public-api.gamma.app/v1.0/generations` - GET `https://public-api.gamma.app/v1.0/generations/{generationId}` ### Parameters #### Request Body (POST) - **inputText** (string) - Required - The text input for generation. - **textMode** (string) - Required - The text processing mode. - **format** (string) - Required - The desired output format. - **numCards** (integer) - Optional - Number of cards for presentation format. #### Path Parameters (GET) - **generationId** (string) - Required - The ID of the generation task. #### Headers - **X-API-KEY** (string) - Required - Your API key. - **Content-Type** (string) - Required for POST - Set to `application/json`. ### Request Example (POST) ```bash curl -s -X POST "https://public-api.gamma.app/v1.0/generations" \ -H "X-API-KEY: sk-gamma-xxxxx" \ -H "Content-Type: application/json" \ -d '{ "inputText": "Create a presentation about renewable energy", "textMode": "generate", "format": "presentation", "numCards": 8 }' ``` ### Response #### Success Response (POST) - **generationId** (string) - The ID of the newly created generation task. #### Success Response (GET) - **status** (string) - Current status (e.g., "completed", "failed", "pending"). - **gammaUrl** (string) - URL to the content if completed. - **error** (object) - Error details if failed. ### Polling Loop Example ```bash # Step 1: Start generation and get ID GENERATION_ID=$(curl -s -X POST "https://public-api.gamma.app/v1.0/generations" \ -H "X-API-KEY: sk-gamma-xxxxx" \ -H "Content-Type: application/json" \ -d '{ "inputText": "Create a presentation about renewable energy", "textMode": "generate", "format": "presentation", "numCards": 8 }' | jq -r '.generationId') echo "Generation ID: $GENERATION_ID" # Step 2: Poll until complete while true; do sleep 5 RESULT=$(curl -s "https://public-api.gamma.app/v1.0/generations/$GENERATION_ID" \ -H "X-API-KEY: sk-gamma-xxxxx") STATUS=$(echo $RESULT | jq -r '.status') echo "Status: $STATUS" if [ "$STATUS" = "completed" ]; then echo "Done! URL: $(echo $RESULT | jq -r '.gammaUrl')" break elif [ "$STATUS" = "failed" ]; then echo "Failed: $(echo $RESULT | jq -r '.error')" exit 1 fi done ``` ``` -------------------------------- ### curl -i example Source: https://developers.gamma.app/docs/guides/async-patterns-and-polling Example of how to make a GET request to the generation endpoint using cURL, including headers. ```APIDOC ## GET /v1.0/generations/{generationId} ### Description Retrieves the status and result of a specific generation. ### Method GET ### Endpoint https://public-api.gamma.app/v1.0/generations/{generationId} ### Parameters #### Path Parameters - **generationId** (string) - Required - The unique identifier of the generation. #### Request Headers - **X-API-KEY** (string) - Required - Your API key for authentication. ### Request Example ```bash curl -i https://public-api.gamma.app/v1.0/generations/abc123 \ -H "X-API-KEY: your-api-key" ``` ### Response #### Success Response (200) - **status** (string) - The current status of the generation (e.g., "processing", "completed", "failed"). - **result** (object) - Contains the generation result if completed. May include fields like `gammaUrl`. - **error** (string) - Contains the error message if the generation failed. #### Response Example ```json { "status": "completed", "result": { "gammaUrl": "https://gamma.app/view/your-generated-content" } } ``` ``` -------------------------------- ### Get Generation by ID (cURL) Source: https://developers.gamma.app/docs/generations/get-generation-status Command-line example using cURL to fetch generation data. Replace 'YOUR_API_KEY' with your valid API key. ```bash curl -L \ --url 'https://public-api.gamma.app/v1.0/generations/{id}' \ --header 'X-API-KEY: YOUR_API_KEY' \ --header 'Accept: */*' ``` -------------------------------- ### Basic Prompt Example Source: https://developers.gamma.app/llms-full.txt Use this to change the topic of a pitch deck. ```json "prompt": "Change this pitch deck about deep sea exploration into one about space exploration." ``` -------------------------------- ### Get Generation Status Request (Python) Source: https://developers.gamma.app/docs/generations/get-generation-status Example of how to make a GET request to the /v1.0/generations/{id} endpoint using Python. Remember to replace YOUR_API_KEY with your actual API key. ```python import requests url = "https://public-api.gamma.app/v1.0/generations/{id}" headers = { "X-API-KEY": "YOUR_API_KEY", "Accept": "*/*" } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Create Generation Job Request Example Source: https://developers.gamma.app/docs/generations/create-generation Example JSON payload for initiating a generation job with text input, formatting options, and image generation settings. ```json { "inputText": "Quarterly sales report for Q3 2024", "additionalInstructions": "Focus on year-over-year growth metrics", "textMode": "generate", "format": "presentation", "numCards": 10, "cardSplit": "auto", "themeId": "theme_abc123", "textOptions": { "amount": "auto", "tone": "professional", "audience": "marketing executives", "language": "en" }, "imageOptions": { "model": "flux-kontext-fast", "style": "photorealistic, professional", "source": "aiGenerated" }, "cardOptions": { "dimensions": "16x9", "headerFooter": { "topLeft": { "type": "text", "source": "themeLogo", "src": "https://example.com/logo.png", "value": "Confidential", "size": "md" }, "topCenter": { "type": "text", "source": "themeLogo", "src": "https://example.com/logo.png", "value": "Confidential", "size": "md" }, "topRight": { "type": "text", "source": "themeLogo", "src": "https://example.com/logo.png", "value": "Confidential", "size": "md" }, "bottomLeft": { "type": "text", "source": "themeLogo", "src": "https://example.com/logo.png", "value": "Confidential", "size": "md" }, "bottomCenter": { "type": "text", "source": "themeLogo", "src": "https://example.com/logo.png", "value": "Confidential", "size": "md" } } } } ``` -------------------------------- ### URL and Validation Examples Source: https://developers.gamma.app/docs/guides/image-url-best-practices A list of example URLs and validation status messages used to verify link processing logic. ```text http://example.com/photo.jpg ``` ```text Not HTTPS ``` ```text https://example.com/image ``` ```text No recognized extension ``` ```text https://example.com/document.pdf ``` ```text Not an image extensi ``` -------------------------------- ### cURL Example for Content Generation Source: https://developers.gamma.app/docs/generations/create-generation Example of how to call the content generation API using cURL. ```APIDOC ## cURL Example for Content Generation ### Description This example demonstrates how to use cURL to send a POST request to the `/v1.0/generations` endpoint to create content. ### Method POST ### Endpoint /v1.0/generations ### Parameters #### Headers - **X-API-KEY** (string) - Required - Your API key for authentication. - **Content-Type** (string) - Required - Specifies the format of the request body, typically `application/json`. #### Request Body - **inputText** (string) - Required - The primary text input for content generation. - **textMode** (string) - Required - Specifies the mode of text generation (e.g., "generate"). ### Request Example ```bash curl -i -X POST "https://public-api.gamma.app/v1.0/generations" \ -H "X-API-KEY: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "inputText": "Create a presentation about renewable energy", "textMode": "generate" }' ``` ``` -------------------------------- ### Get Generation by ID (JavaScript) Source: https://developers.gamma.app/docs/generations/get-generation-status JavaScript example using the fetch API to retrieve generation details. Remember to substitute 'YOUR_API_KEY' and '{id}'. ```javascript const response = await fetch('https://public-api.gamma.app/v1.0/generations/{id}', { method: 'GET', ``` -------------------------------- ### Gamma API Request Example Source: https://developers.gamma.app/docs/connectors/connectors-and-integrations This is an example of a POST request to the Gamma API to generate content. Ensure your API key is included in the X-API-KEY header. This API should only be called from a backend server. ```http POST https://public-api.gamma.app/v1.0/generations Content-Type: application/json X-API-KEY: YOUR_API_KEY { "content": { "type": "text", "text": "Create a presentation about the benefits of AI in education." }, "parameters": { "output_format": "presentation" } } ``` -------------------------------- ### JSON Configuration Example Source: https://developers.gamma.app/docs/reference/warnings A sample JSON configuration block used within the application. ```json { "format": "presentation", ``` -------------------------------- ### Start and Wait for Generation (JavaScript) Source: https://developers.gamma.app/docs/guides/async-patterns-and-polling This JavaScript code demonstrates how to start a generation task and poll for its completion. It includes error handling and dynamic polling intervals based on rate limits. ```APIDOC ## Start and Wait for Generation ### Description Initiates a content generation task and polls the API until the generation is complete, failed, or timed out. It dynamically adjusts the polling interval based on the remaining rate limit. ### Method POST, GET ### Endpoint - POST /v1.0/generations - GET /v1.0/generations/{generationId} ### Parameters #### Request Body (POST /v1.0/generations) - **inputText** (string) - Required - The primary text input for generation. - **textMode** (string) - Required - The mode of text processing (e.g., "generate"). - **format** (string) - Required - The desired output format (e.g., "presentation"). - **numCards** (integer) - Optional - The number of cards to generate for a presentation. #### Path Parameters (GET /v1.0/generations/{generationId}) - **generationId** (string) - Required - The ID of the generation task to poll. #### Headers - **X-API-KEY** (string) - Required - Your Gamma App API key. - **Content-Type** (string) - Required for POST requests - Set to "application/json". ### Request Example (POST /v1.0/generations) ```json { "inputText": "Create a presentation about renewable energy", "textMode": "generate", "format": "presentation", "numCards": 8 } ``` ### Response #### Success Response (200 OK for GET) - **generationId** (string) - The ID of the generation task. - **status** (string) - The current status of the generation (e.g., "completed", "failed", "pending"). - **gammaUrl** (string) - The URL to the generated content if status is "completed". - **error** (object) - Details about the error if status is "failed". - **credits** (object) - Information about credit deduction and remaining credits. - **deducted** (integer) - Credits deducted for this generation. - **remaining** (integer) - Remaining credits. #### Response Example (GET /v1.0/generations/{generationId} - Completed) ```json { "generationId": "abc123", "status": "completed", "gammaUrl": "https://gamma.app/docs/abc123", "credits": { "deducted": 15, "remaining": 485 } } ``` ### Rate Limiting - Headers like `X-RateLimit-Remaining-Burst` indicate remaining requests. Adjust `pollInterval` based on these values. ``` -------------------------------- ### Code Examples Section Source: https://developers.gamma.app/docs/guides/async-patterns-and-polling This section contains code examples for various programming languages. ```N/A $"h3", "ODjRT2aa4Wot", { "id": "code-examples", "className": "text-lg @xs:text-xl @lg:text-2xl font-semibold heading pdf-heading flex items-baseline scroll-mt-(--content-scroll-margin) text-start self-start justify-start relative group/hash mx-auto page-width-wide:mx-0 w-full decoration-primary/6 max-w-3xl print:break-inside-avoid page-api-block:ml-0 column-first-of-type:pt-0 pt-\[0.75em\]", "data-pdf-heading": true, "children": [ [ "$", "div", null, { "className": "relative hash grid grid-area-1-1 h-\[1em\] border-0 opacity-0 site-background rounded group-hover/hash:opacity-\[0\] group-focus/hash:opacity-\[0\] md:group-hover/hash:opacity-\[1\] md:group-focus/hash:opacity-\[1\] -ml-6 pr-2 [ .flip-heading-hash_\u0026 ]:order-last [ .flip-heading-hash_\u0026 ]:ml-1 [ .flip-heading-hash_\u0026 ]:pl-2", "children": [ "$", "$L97", null, { "href": "#code-examples", "aria-label": "Direct link to heading", "className": "inline-flex h-full items-start leading-snug", "children": [ "$", "$L43", null, { "icon": "hashtag", "className": "self-center transition-colors text-transparent group-hover/hash:text-tint-subtle contrast-more:group-hover/hash:text-tint-strong size-4" } ] } ] }, [ "$", "div", null, { "className": "flex-1 z-1 justify-self-start max-w-full break-words text-start self-start justify-start leading-snug", "children": [ [ "$", "$1", "rVrbbuxFXaqK", { "children": [ [ "$", "$1", "0", { "children": [ "Code examples" ] } ] ] } ] ] } ] ] } ] ] } ``` -------------------------------- ### Code Examples with Language Tabs Source: https://developers.gamma.app/docs/guides/async-patterns-and-polling This component displays code examples in different languages using tabs. ```N/A $"7Aw0aAibi2PS", { "id": "7Aw0aAibi2PS", "tabs": [ { "id": "python", "title": "Python", "body": [ "$", "div", "FgGzvck3ziRi", { "className": "w-full space-y-4", "children": [ "$La9" ] } ] }, { "id": "javascript", "title": "JavaScript", "body": [ "$", "div", "Ni14iLBe9PDB", { "className": "w-full space-y-4", "children": [ "$Laa" ] } ] }, { "id": "curl", "title": "cURL", "body": [ "$", "div", "UrSnDS4AuqPm", { "className": "w-full space-y-4", "children": [ "$Lab" ] } ] } ], "className": "mx-auto page-width-wide:mx-0 w-full decoration-primary/6 max-w-3xl print:break-inside-avoid page-width-wide:max-w-full page-api-block:ml-0" } ``` -------------------------------- ### Start LLM Text Generation Source: https://developers.gamma.app/docs/guides/async-patterns-and-polling Initiates a text generation task by sending a POST request to the generation endpoint. Includes setting the 'Content-Type' header and stringifying the payload. Handles potential errors during the start request. ```javascript const startResponse = await fetch("/api/v1/generation/start", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); if (!startResponse.ok) { throw new Error(`Failed to start: ${await startResponse.text()}`); } const { generationId } = await startResponse.json(); console.log(`Generation started: ${generationId}`); ``` -------------------------------- ### GET /v1.0/themes Source: https://developers.gamma.app/docs/guides/generate-api-parameters-explained List all themes available in your workspace, including custom themes. ```APIDOC ## GET /v1.0/themes ### Description List all themes available in your workspace, including custom themes. ### Method GET ### Endpoint /v1.0/themes ``` -------------------------------- ### Sample JSON Response Source: https://developers.gamma.app/docs/workspace/list-themes Example structure of the data returned by the themes endpoint. ```json { "data": [ { "id": "theme_abc123", "name": "Corporate Blue", "colorKeywords": [ "blue", ``` -------------------------------- ### GET /themes Source: https://developers.gamma.app/docs/guides/create-from-template-api-parameters-explained List all themes available in your workspace, including custom themes. ```APIDOC ## GET /themes ### Description List all themes available in your workspace, including custom themes. ### Method GET ### Endpoint /themes ``` -------------------------------- ### Complete Presentation Configuration Example Source: https://developers.gamma.app/llms-full.txt A full request object demonstrating a combination of custom logo, card numbers, and text with visibility toggles. ```json { "inputText": "Create a quarterly business review for Q4 2024", "textMode": "generate", "format": "presentation", "numCards": 12, "cardOptions": { "dimensions": "16x9", "headerFooter": { "topRight": { "type": "image", "source": "custom", "src": "https://example.com/company-logo.png", "size": "sm" }, "bottomRight": { "type": "cardNumber" }, "bottomLeft": { "type": "text", "value": "Confidential - Internal Use Only" }, "hideFromFirstCard": true, "hideFromLastCard": true } } } ``` -------------------------------- ### Get Themes API Endpoint Source: https://developers.gamma.app/docs/workspace/list-themes This snippet shows how to make a GET request to the /v1.0/themes endpoint. It includes examples for cURL, JavaScript, and Python. ```curl curl \ --request GET \ --url https://public-api.gamma.app/v1.0/themes \ --header "accept: application/json" ``` ```javascript const options = { method: 'GET', headers: { 'accept': 'application/json' } }; fetch('https://public-api.gamma.app/v1.0/themes', options) .then(response => response.json()) .then(response => console.log(response)) .catch(error => console.error(error)); ``` ```python import requests url = "https://public-api.gamma.app/v1.0/themes" headers = { "accept": "application/json" } response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Configure image style presets Source: https://developers.gamma.app/llms-full.txt Examples for setting image styles using named presets or custom style strings. ```json "imageOptions": { "stylePreset": "illustration", "source": "aiGenerated" } ``` ```json "imageOptions": { "stylePreset": "custom", "style": "watercolor, soft edges, muted tones" } ``` -------------------------------- ### Get Generation Status Request (cURL) Source: https://developers.gamma.app/docs/generations/get-generation-status Example of how to make a GET request to the /v1.0/generations/{id} endpoint using cURL. Replace YOUR_API_KEY with your actual API key. ```bash GET /v1.0/generations/{id} HTTP/1.1 Host: public-api.gamma.app X-API-KEY: YOUR_API_KEY Accept: */* ``` -------------------------------- ### Get Generation Status Request (JavaScript) Source: https://developers.gamma.app/docs/generations/get-generation-status Example of how to make a GET request to the /v1.0/generations/{id} endpoint using JavaScript. Ensure you replace YOUR_API_KEY with your actual API key. ```javascript const options = { method: 'GET', headers: { 'X-API-KEY': 'YOUR_API_KEY', 'Accept': '*/*' } }; fetch('https://public-api.gamma.app/v1.0/generations/{id}', options) .then(response => response.json()) .then(response => console.log(response)) .catch(error => console.error(error)); ``` -------------------------------- ### List Folders API Request (First Page) Source: https://developers.gamma.app/docs/guides/list-themes-and-list-folders-apis-explained This example demonstrates how to fetch the first page of folders in your workspace using cursor-based pagination. The pattern is identical to listing themes. ```bash curl -X GET "https://public-api.gamma.app/v1.0/folders?limit=10" \ -H "X-API-KEY: sk-gamma-xxxxxxxx" ``` -------------------------------- ### Execute authenticated API request Source: https://developers.gamma.app/docs/guides/async-patterns-and-polling Example of using curl to perform a GET request with an API key header. ```bash curl -i https://public-api.gamma.app/v1.0/generations/abc123 \ -H "X-API-KEY: your-api-key" ``` -------------------------------- ### Creating Content from Scratch Source: https://developers.gamma.app/docs/get-started/understanding-the-api-options Use this method for maximum flexibility when you need to control format, tone, audience, images, layout, and more. No specific setup is required beyond initiating the creation process. ```text Creating from scratch. Maximum flexibility — you control format, tone, audience, images, layout, and more. ``` -------------------------------- ### Retrieve generation status via cURL Source: https://developers.gamma.app/docs/guides/async-patterns-and-polling Example of a direct GET request to check the status of a specific generation ID. ```bash curl -i https://public-api.gamma.app/v1.0/generations/abc123 \ -H "X-API-KEY: your-api-key" ``` -------------------------------- ### Use Throughput Management Tool Source: https://developers.gamma.app/docs/guides/async-patterns-and-polling This example suggests using a specific tool or library for managing the throughput of parallel generation tasks. Refer to the documentation of the mentioned tool for implementation details. ```text Use the " ``` -------------------------------- ### Example of valid URL with query parameters Source: https://developers.gamma.app/docs/guides/image-url-best-practices This snippet demonstrates a URL format that is correctly parsed by Gamma. ```text https://cdn.example.com/photo.jpg?width=800&quality=90 ``` -------------------------------- ### Get Generation by ID (HTTP) Source: https://developers.gamma.app/docs/generations/get-generation-status Example HTTP request to retrieve a specific generation by its ID. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```http GET /v1.0/generations/{id} HTTP/1.1 Host: public-api.gamma.app X-API-KEY: YOUR_API_KEY Accept: */* ``` -------------------------------- ### Example Card Options Configuration Source: https://developers.gamma.app/docs/guides/generate-api-parameters-explained Use this JSON structure to define card header and footer elements, including image sources and card numbering. ```json "cardOptions": { "headerFooter": { "topRight": { "type": "image", "source": "themeLogo", "size": "sm" }, "bottomRight": { "type": "cardNumber" }, "hideFromFirstCard": true } } ``` ```json "dimensions": "16x9" } ``` -------------------------------- ### Text Generation Request Examples Source: https://developers.gamma.app/docs/guides/create-from-template-api-parameters-explained Examples of request bodies for text generation. ```APIDOC ## Text Generation Request Examples ### Request Body Examples #### Basic Prompt ```json { "prompt": "Change this pitch deck about deep sea exploration into one about space exploration." } ``` #### Prompt with Additional Details ```json { "prompt": "Change this pitch deck about deep sea exploration into one about space exploration. Use this quote and this image in the title card: That's one small step for man, one giant leap for mankind - Neil Armstrong, https://www.global-aero.com/wp-content/uploads/2020/06/ga-iss.jpg" } ``` #### Specifying Theme ID ```json { "themeId": "abc123def456ghi" } ``` ``` -------------------------------- ### List Themes using JavaScript Source: https://developers.gamma.app/docs/workspace/list-themes Example of how to list themes using JavaScript. This snippet demonstrates making a fetch request to the API. ```javascript fetch("https://public-api.gamma.app/v1.0/themes", { "headers": { "X-API-KEY": "YOUR_API_KEY" } }).then(response => response.json()).then(data => console.log(data)); ``` -------------------------------- ### Configure Card Header/Footer Source: https://developers.gamma.app/docs/guides/header-and-footer-formatting Set up header and footer elements for cards. This example shows a 'topLeft' image and 'topRight' text. ```json "headerFooter": { "topLeft": { "type": "image", "source": "themeLogo", "size": "md" }, "topRight": { "type": "text", "value": "Technical Specification" } } ``` -------------------------------- ### Initiate Generation with cURL Source: https://developers.gamma.app/docs/guides/async-patterns-and-polling Use this cURL command to start a generation process by sending a POST request to the Gamma API. ```bash # Step 1: Start generation GENERATION_ID=$(curl -s -X POST "https://public-api.gamma.app/v1.0/generations" \ -H "X-API-KEY: sk-gamma-xxxxx" \ -H "Content-Type: application/json" \ ``` -------------------------------- ### Example Error Response Source: https://developers.gamma.app/llms-full.txt An example of the JSON structure for an error response from the Gamma API. ```APIDOC ## Example Error Response ```json { "message": "Invalid API key.", "statusCode": 401 } ``` ``` -------------------------------- ### List Themes using cURL Source: https://developers.gamma.app/docs/workspace/list-themes Example of how to list themes using cURL. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```shell GET /v1.0/themes HTTP/1.1 Host: public-api.gamma.app X-API-KEY: YOUR_API_KEY Accept: */* ``` -------------------------------- ### Custom Style Description for AI Images Source: https://developers.gamma.app/docs/mcp/mcp-tools-reference This example illustrates how to provide a custom style description for AI images. It uses 'stylePreset' for predefined styles or 'custom' for unique descriptions. ```javascript Custom style description for AI images (used when ``` ```javascript stylePreset ``` ```javascript is ``` ```javascript custom ``` ```javascript or omitted) ``` -------------------------------- ### Define inputText with simple content Source: https://developers.gamma.app/llms-full.txt A basic example of providing a topic string for content generation. ```json "inputText": "Ways to use AI for productivity" ``` -------------------------------- ### Add Specific Instructions for Gamma Output Source: https://developers.gamma.app/llms-full.txt Provide detailed `additionalInstructions` to guide content, layout, and style. Ensure instructions do not conflict with other parameters for best results. Character limit is 5000. ```json "additionalInstructions": "Make the card headings humorous and catchy" ``` -------------------------------- ### Example Error Response (JSON) Source: https://developers.gamma.app/llms-full.txt This is an example of an error response from the Gamma API, typically returned for issues like an invalid API key. ```json { "message": "Invalid API key.", "statusCode": 401 } ``` -------------------------------- ### Retrieve themes via cURL Source: https://developers.gamma.app/docs/workspace/list-themes Example of using the cURL command-line tool to fetch themes. ```bash curl -L \ --url 'https://public-api.gamma.app/v1.0/themes' \ --header 'X-API-KEY: YOUR_API_KEY' \ --header 'Accept: */*' ``` -------------------------------- ### Text Generation Type (Enum Example) Source: https://developers.gamma.app/docs/mcp/mcp-tools-reference Provides an example of using an enum for text generation type. This is a common pattern for selecting generation strategies. ```javascript self.__next_f.push([1,"c0:[\"$\",\"div\",null,{\"aria-labelledby\":\"$undefined\",\"className\":\"blocks w-full space-y-2 lg:space-y-3 leading-normal self-center **:text-left text-left\",\"children\":[[\"$\",\"p\",\"M9jk98jXzSFU\",{\"className\":\"has-\\[.button,input\\]:flex has-\\[.button,input\\]:flex-wrap has-\\[.button,input\\]:gap-2 has-\\[.button,input\\]:items-center mx-auto page-width-wide:mx-0 decoration-primary/6 print:break-inside-avoid w-full max-w-\\[unset\"],\"children\":[[\"$\",\"$1\",\"Notvf1zCSFbf\",{\"children\":[[\"$\",\"$1\",\"0\",{\"children\":[[\"$\",\"code\",\"mark\",{\"className\":\"py-px px-1.5 min-w-6.5 justify-center items-center ring-1 ring-inset ring-tint bg-tint rounded-sm text-\\[.875em\\] leading-\\[calc(max(1.20em,1.25rem))\\] break-words hyphens-none\",\"children\":\"enum\"}]}]}]}]}]]) ``` -------------------------------- ### JSON Text Options Configuration Source: https://developers.gamma.app/docs/guides/generate-api-parameters-explained Examples of JSON objects defining text options with different parameters. ```json "textOptions": { "audience": "seven year olds" } ``` ```json "textOptions": { "language": "en" } ``` -------------------------------- ### Generation Status Response Example Source: https://developers.gamma.app/docs/generations/get-generation-status An example of a successful JSON response when retrieving the status of a generation job. This includes details like generation ID, status, and optional gamma-related URLs. ```json { "generationId": "abc123xyz", "status": "completed", "gammaId": "9xJZ8QmN2", "gammaUrl": "https://gamma.app/docs/abc123", "error": { "message": "Failed to generate content", "statusCode": 500 }, "exportUrl": "https://gamma.app/export/abc123.pdf", "credits": { "deducted": 10, "remaining": 490 } } ``` -------------------------------- ### Example API response with rate limit headers Source: https://developers.gamma.app/llms-full.txt This is an example of an API response that includes rate limit headers. These headers provide information about your current request limits and remaining capacity. ```json HTTP/2 200 content-type: application/json x-ratelimit-limit-burst: 10000 x-ratelimit-remaining-burst: 9994 x-ratelimit-limit: 40000 x-ratelimit-remaining: 39988 x-ratelimit-limit-daily: 200000 x-ratelimit-remaining-daily: 199950 { "generationId": "abc123", "status": "completed", "gammaUrl": "https://gamma.app/docs/abc123", "credits": { "deducted": 15, "remaining": 485 } } ``` -------------------------------- ### Generate Content with Basic Prompt Source: https://developers.gamma.app/docs/guides/create-from-template-api-parameters-explained Example of a JSON request to generate content using a simple text prompt. ```json { "prompt": "Change this pitch deck about deep sea exploration into one about space exploration." } ``` -------------------------------- ### Configure document with theme logo Source: https://developers.gamma.app/llms-full.txt Sets up an 8-card document with a theme logo in the top-left, a title in the top-right, and page numbering in the bottom-right. ```json { "inputText": "Technical specification for Project X", "textMode": "generate", "format": "document", "numCards": 8, "cardOptions": { "dimensions": "letter", "headerFooter": { "topLeft": { "type": "image", "source": "themeLogo", "size": "md" }, "topRight": { "type": "text", "value": "Technical Specification" }, "bottomRight": { "type": "cardNumber" } } } } ``` -------------------------------- ### Get Generation Status OpenAPI Specification Source: https://developers.gamma.app/llms-full.txt This OpenAPI specification defines the GET /generations/{id} endpoint for polling the status of a generation job. It includes request parameters, response schemas for success and errors, and authentication details. ```json {"openapi":"3.0.0","info":{"title":"Gamma Public API","version":"1.0"},"tags":[{"name":"public-api","description":"Public API endpoints for external integrations"}],"servers":[{"url":"https://public-api.gamma.app","description":"Production"}],"security":[{"api-key":[]}],"components":{"securitySchemes":{"api-key":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"API key for authentication"}},"schemas":{"GenerationStatusResponse":{"type":"object","properties":{"generationId":{"type":"string","description":"Generation job identifier"},"status":{"$ref":"#/components/schemas/GenerationStatus"},"gammaId":{"type":"string","description":"File identifier for the generated Gamma"},"gammaUrl":{"type":"string","description":"URL to view the generated Gamma"},"error":{"description":"Error details when status is \"failed\"","allOf":[{"$ref":"#/components/schemas/ErrorResponse"}]},"exportUrl":{"type":"string","description":"Download URL for exported file (PDF/PPTX)"},"credits":{"description":"Credit deduction details","allOf":[{"$ref":"#/components/schemas/CreditsResponse"}]}},"required":["generationId","status"]},"GenerationStatus":{"type":"string","description":"Current status of the generation job","enum":["pending","completed","failed"]},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string","description":"Human-readable error description"},"statusCode":{"type":"number","description":"HTTP status code"}},"required":["message","statusCode"]},"CreditsResponse":{"type":"object","properties":{"deducted":{"type":"number","description":"Credits deducted for this generation"},"remaining":{"type":"number","description":"Credits remaining in workspace after deduction"}},"required":["deducted","remaining"]}}},"paths":{"/v1.0/generations/{id}":{"get":{"operationId":"getGenerationStatus","summary":"Get generation status","description":"Retrieves the current status of a generation job. Poll this endpoint until status is \"completed\" or \"failed\".","parameters":[{"name":"id","required":true,"in":"path","description":"The unique generation ID returned from the create endpoint","schema":{"type":"string"}}],"responses":{"200":{"description":"Generation status retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationStatusResponse"}}}},"401":{"description":"Invalid or missing API key"},"404":{"description":"Generation not found"}},"tags":["public-api"]}}}}} ``` -------------------------------- ### GET /v1.0/themes Source: https://developers.gamma.app/docs/workspace/list-themes Retrieves a list of all available themes. ```APIDOC ## GET /v1.0/themes ### Description Retrieves a list of all available themes. ### Method GET ### Endpoint https://public-api.gamma.app/v1.0/themes ### Request Body This endpoint does not accept a request body. ### Response #### Success Response (200) - **themes** (array) - A list of theme objects. - **id** (string) - The unique identifier for the theme. - **name** (string) - The name of the theme. - **description** (string) - A brief description of the theme. #### Response Example ```json { "themes": [ { "id": "theme-1", "name": "Default Theme", "description": "The default theme for the application." }, { "id": "theme-2", "name": "Dark Mode", "description": "A dark theme for better readability in low light." } ] } ``` ``` -------------------------------- ### Set Theme and Folder Configuration Source: https://developers.gamma.app/docs/guides/create-from-template-api-parameters-explained Configures the visual theme and destination folders for generated content. ```json "themeId": "abc123def456ghi" ``` ```json "folderIds": ["123abc456def", "456123abcdef"] ``` -------------------------------- ### GET /v1.0/folders Source: https://developers.gamma.app/docs/guides/list-themes-and-list-folders-apis-explained Retrieves a list of folder IDs. ```APIDOC ## GET /v1.0/folders ### Description Call this endpoint to get values for folderIds. ### Method GET ### Endpoint /v1.0/folders ``` -------------------------------- ### List Folders Request (HTTP) Source: https://developers.gamma.app/docs/workspace/list-folders Example of an HTTP request to list folders. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```http GET /v1.0/folders HTTP/1.1 Host: public-api.gamma.app X-API-KEY: YOUR_API_KEY Accept: */* ```