2Slides Logo
2slides API 튜토리얼 - AI 프레젠테이션 제작 완벽 가이드
2Slides Team
13 min read

2slides API 튜토리얼 - AI 프레젠테이션 생성을 위한 완벽 가이드

2slides API 종합 가이드에 오신 것을 환영합니다! 이 튜토리얼은 AI 기반 프레젠테이션 생성 기능을 여러분의 애플리케이션에 통합하는 데 필요한 모든 것을 안내해 드릴 것입니다.

개요

2slides API를 사용하면 AI를 활용하여 전문적인 프레젠테이션을 프로그래밍 방식으로 생성할 수 있습니다. 타임라인, 로드맵, 마인드맵 등 다양한 프레젠테이션 유형을 지원하여 간단한 텍스트 입력만으로 멋진 슬라이드를 만들 수 있습니다.

주요 기능

  • AI 기반 생성: 텍스트로부터 전문적인 프레젠테이션 자동 생성
  • 다양한 템플릿 유형: 타임라인, 로드맵, 마인드맵, 피치 덱, 인포그래픽 등 지원
  • 다국어 지원: 여러 언어로 콘텐츠 생성
  • 풍부한 템플릿 라이브러리: 수백 개의 전문적으로 디자인된 템플릿 이용 가능
  • 사용자 지정 템플릿: 나만의 슬라이드 템플릿 업로드 및 사용
  • 템플릿 검색: 이름, 키워드 및 태그를 통해 템플릿 검색
  • 다운로드 옵션: PowerPoint(.pptx) 형식으로 프레젠테이션 다운로드
  • 실시간 상태 추적: 작업 상태 엔드포인트를 통해 생성 진행 상황 모니터링

주요 프레젠테이션 유형

Image

모든 프레젠테이션 템플릿은 2slides Templates에서 확인할 수 있습니다. 특히, 특정 목적과 시나리오에 매우 효과적인 몇 가지 주요 프레젠테이션 유형이 있습니다.

  1. 타임라인 슬라이드 - 프로젝트 타임라인 및 역사적 사건에 적합
  2. 로드맵 슬라이드 - 제품 로드맵 및 프로젝트 계획에 이상적
  3. 마인드맵 슬라이드 - 개념 매핑 및 지식 구조화에 탁월

시작하기

기본 URL

모든 API 요청은 다음으로 이루어져야 합니다:

https://2slides.com

사전 준비 사항

  1. 계정 설정: 2slides.com에서 계정을 생성하세요.
  2. API 키: API 관리 페이지에서 API 키를 생성하세요.
  3. 크레딧: 슬라이드 생성을 위한 충분한 크레딧이 있는지 확인하세요 (슬라이드 페이지당 10 크레딧).

빠른 시작

  1. API 관리 페이지에서 API 키를 받으세요.
  2. 테마 검색 엔드포인트를 사용하여 테마를 검색하거나, 템플릿을 탐색하여 슬라이드 테마 ID를 얻으세요.
  3. 콘텐츠와 선택한 테마 ID로 슬라이드를 생성합니다. 이는 결과 슬라이드가 반환되는 동기 호출과 작업 ID가 반환되는 비동기 호출을 모두 지원합니다. 동기 호출을 사용하는 경우, 다음 단계 4와 5는 필요하지 않습니다.
  4. 생성된 슬라이드 다운로드 URL이 제공될 때까지 작업 상태를 확인합니다.
  5. 제공된 다운로드 URL을 사용하여 프레젠테이션을 다운로드합니다.

인증

Image

모든 API 엔드포인트는 API 키를 사용한 인증을 필요로 합니다. API 관리 인터페이스를 통해 API 키를 관리할 수 있습니다.

API 키 형식

API 키는 다음 형식을 따릅니다:

sk-2slides-{64-character-hex-string}

인증 방법

Authorization 헤더

Authorization: Bearer sk-2slides-your-api-key-here

API 키 관리

  • 최대 키 개수: 각 사용자는 최대 10개의 API 키를 생성할 수 있습니다.
  • 키 이름 지정: 쉽게 식별할 수 있도록 키에 설명적인 이름을 부여하세요.
  • 보안: API 키를 안전하게 보관하고 공개적으로 공유하지 마세요.
  • 키 로테이션: 보안 강화를 위해 API 키를 정기적으로 로테이션하세요.

⚠️ 중요 보안 고지: 2slides 플랫폼은 보안상의 이유로 API 키를 평문으로 저장하지 않습니다. 생성 즉시 API 키를 복사하여 안전하게 보관해야 합니다. API 키를 분실한 경우, 원본은 복구할 수 없으므로 새 키를 생성해야 합니다.

API 엔드포인트

1. 슬라이드 생성 (Fast PPT)

특정 테마를 사용하여 텍스트 입력으로부터 슬라이드(Fast PPT)를 생성합니다.

엔드포인트:

POST /api/v1/slides/generate

헤더:

Authorization: Bearer sk-2slides-your-api-key-here Content-Type: application/json

요청 본문:

{ "userInput": "Your presentation content here...", "themeId": "theme-uuid-here", "responseLanguage": "Auto" }

매개변수:

  • userInput
    (필수): 슬라이드를 생성할 콘텐츠
  • themeId
    (필수): 슬라이드 생성에 사용할 테마의 ID. 다음 중 하나일 수 있습니다:
    • 템플릿 갤러리의 공개 테마
    • 계정을 통해 접근 가능한 사용자 지정 업로드 테마
  • responseLanguage
    (선택 사항): 생성된 슬라이드의 언어. 자동 감지를 위해 "Auto"를 사용합니다.
  • mode
    (선택 사항): 동기(sync) 또는 비동기(async) 호출, "sync"가 기본값입니다.

사용 가능한 언어:

  • Auto
    - 입력에서 언어 자동 감지 (기본값)
  • English
    - 영어
  • Simplified Chinese
    - 简体中文
  • Traditional Chinese
    - 繁體中文
  • Spanish
    - Español
  • Arabic
    - العربية
  • Portuguese
    - Português
  • Indonesian
    - Bahasa Indonesia
  • Japanese
    - 日本語
  • Russian
    - Русский
  • Hindi
    - हिंदी
  • French
    - Français
  • German
    - Deutsch
  • Vietnamese
    - Tiếng Việt
  • Turkish
    - Türkçe
  • Polish
    - Polski
  • Italian
    - Italiano
  • Korean
    - 한국어

비동기 모드 응답:

{ "success": true, "data": { "jobId": "job-uuid-here", "status": "processing", "message": "Slides generation started. Use the jobId to check status.", "credits": { "current": 150, "required": 30 } } }

동기 모드 응답:

{ "success": true, "data": { "jobId": "1pFqIww3JjquQ1T3Ysmw1", "status": "success", "message": "Slides generated successfully", "downloadUrl": "https://presigned-url-here", "createdAt": 1760347015388, "updatedAt": 1760347048261, "duration": 32694, "slidePageCount": 9 } }

2. 작업 상태 확인 (Fast PPT)

슬라이드 생성 작업(Fast PPT)의 상태를 확인하고 완료 시 결과를 얻습니다.

엔드포인트:

GET /api/v1/jobs/{jobId}

헤더:

Authorization: Bearer sk-2slides-your-api-key-here

응답 예시:

처리 중:

{ "success": true, "data": { "jobId": "job-uuid-here", "status": "processing", "message": "Slides generation in progress", "createdAt": 1703123456789, "updatedAt": 1703123460000 } }

성공:

{ "success": true, "data": { "jobId": "job-uuid-here", "status": "success", "message": "Slides generated successfully", "downloadUrl": "https://presigned-url-here", "createdAt": 1703123456789, "updatedAt": 1703123500000, "duration": 33211, "slidePageCount": 3 } }

실패:

{ "success": true, "data": { "jobId": "job-uuid-here", "status": "failed", "message": "Slides generation failed", "errorMessage": "Insufficient credits for generation", "createdAt": 1703123456789, "updatedAt": 1703123460000 } }

3. 이와 유사한 슬라이드 생성 (Nano Banana Pro)

참조 이미지를 사용하여 슬라이드(Nano Banana Pro)를 생성합니다. 이 엔드포인트는 동기 모드를 사용하며, 모든 슬라이드가 완료되면 자동으로 PDF를 생성합니다.

엔드포인트:

POST /api/v1/slides/create-like-this

헤더:

Authorization: Bearer sk-2slides-your-api-key-here Content-Type: application/json

요청 본문:

{ "userInput": "Your presentation content here...", "referenceImageUrl": "https://example.com/reference-image.jpg", "responseLanguage": "Auto", "aspectRatio": "16:9", "resolution": "2K", "page": 1 }

매개변수:

  • userInput
    (필수): 슬라이드를 생성할 콘텐츠
  • referenceImageUrl
    (필수): 디자인 스타일을 따를 참조 이미지의 URL. 다음을 지원합니다:
    • HTTP/HTTPS URL
    • Base64 데이터 URL (data:image/...)
  • responseLanguage
    (선택 사항): 생성된 슬라이드의 언어. 자동 감지를 위해 "Auto"를 사용합니다 (기본값: "Auto").
  • aspectRatio
    (선택 사항): 슬라이드의 가로세로 비율. 형식: "width:height" (기본값: "16:9").
  • resolution
    (선택 사항): 슬라이드 이미지의 해상도. 옵션: "1K", "2K", "4K" (기본값: "2K").
  • page
    (선택 사항): 생성할 슬라이드 수. 자동 감지를 위해 0을 사용합니다. 특정 슬라이드 수를 강제하려면 숫자(>=1, 최대: 100)를 지정합니다. 기본값: 1.
  • contentDetail
    (선택 사항): 슬라이드의 콘텐츠 상세 수준. 옵션: "concise" (간결하고 키워드 중심) 또는 "standard" (포괄적이고 상세). 기본값: "concise".

응답:

{ "success": true, "data": { "jobId": "job-uuid-here", "status": "success", "message": "Successfully generated 5 slides", "downloadUrl": "https://presigned-url-to-pdf.pdf", "jobUrl": "https://2slides.com/workspace?jobId=job-uuid-here", "createdAt": 1703123456789, "updatedAt": 1703123500000, "slidePageCount": 5, "successCount": 5, "failedCount": 0 } }

상태 값:

  • success
    : 모든 슬라이드가 성공적으로 생성되었으며, PDF를 사용할 수 있습니다.
  • partial
    : 일부 슬라이드 생성이 실패했습니다.
  • failed
    : 모든 슬라이드 생성이 실패했습니다.

참고: 이 엔드포인트는 동기 모드로 실행되며, 모든 슬라이드가 생성될 때까지 기다린 후 반환됩니다.

4. 테마 검색 (Fast PPT)

키워드로 사용 가능한 슬라이드 테마(Fast PPT)를 검색합니다. 여기에는 공개 테마와 사용자 지정 업로드 테마가 모두 포함됩니다.

엔드포인트:

GET /api/v1/themes/search

헤더:

Authorization: Bearer sk-2slides-your-api-key-here

쿼리 매개변수:

  • query
    (필수): 테마 이름, 설명 및 태그에서 검색할 키워드
  • limit
    (선택 사항): 최대 결과 수 (1-100, 기본값 20)

요청 예시:

GET /api/v1/themes/search?query=timeline&limit=10

응답:

{ "success": true, "data": { "total": 25, "themes": [ { "id": "theme-uuid-1", "name": "Modern Timeline", "description": "Clean and modern timeline template for project presentations", "tags": "timeline, modern, project, clean", "themeURL": "https://2slides.com/templates/st-1759917935785-nx0z6ae54" }, { "id": "theme-uuid-2", "name": "Business Roadmap", "description": "Professional roadmap template for business planning", "tags": "roadmap, business, planning, professional", "themeURL": "https://2slides.com/templates/st-1755509077270-sftfm616s" } ] } }

Rate Limiting

API는 공정한 사용과 시스템 안정성을 보장하기 위해 Rate Limiting을 구현합니다. 엔드포인트마다 다른 Rate Limit이 적용됩니다:

엔드포인트시간 창최대 요청 수설명
/api/v1/slides/generate
1분6 요청핵심 생성 엔드포인트
/api/v1/slides/create-like-this
1분6 요청참조 이미지로부터 슬라이드 생성
/api/v1/jobs
1분10 요청작업 상태 확인
/api/v1/themes/search
1분30 요청테마 검색

Rate Limit 헤더

Rate Limit을 초과하면 API는 다음 헤더와 함께

429 Too Many Requests
응답을 반환합니다:

HTTP/1.1 429 Too Many Requests X-RateLimit-Limit: 6 X-RateLimit-Remaining: 0 X-RateLimit-Reset: 1703123600 Retry-After: 45

Rate Limit 처리

API 호출 Rate Limit을 신중하게 처리해야 합니다. 다음은 Javascript 예시입니다.

async function makeApiRequest(url, options) { try { const response = await fetch(url, options); if (response.status === 429) { const retryAfter = response.headers.get('Retry-After'); console.log(`Rate limited. Retry after ${retryAfter} seconds`); await new Promise(resolve => setTimeout(resolve, retryAfter * 1000)); return makeApiRequest(url, options); // Retry } return response; } catch (error) { console.error('API request failed:', error); throw error; } }

크레딧 시스템

2slides는 슬라이드 생성을 위해 크레딧 기반 시스템을 사용합니다. 각 슬라이드 페이지는 10 크레딧이 소모됩니다.

크레딧 규칙

  • 신규 사용자: 가입 시 880 무료 크레딧 지급
  • 비용: Fast PPT 슬라이드 페이지당 10 크레딧, 1K/2K Nano Banana Pro 슬라이드 페이지당 100 크레딧, 4K Nano Banana Pro 슬라이드 페이지당 200 크레딧
  • 최소: 사용자는 생성을 시작하기 위해 최소 10 크레딧이 필요합니다.
  • 차감: 크레딧은 성공적인 생성 후에만 차감됩니다.
  • 환불: 생성이 실패하면 크레딧이 환불됩니다.

크레딧 확인

계정 대시보드를 통해 또는 API 응답의 크레딧 정보를 확인하여 크레딧 잔액을 확인할 수 있습니다.

크레딧 구매

가격 페이지를 통해 다양한 결제 수단을 사용하여 추가 크레딧을 구매할 수 있습니다.

예시

전체 워크플로우 예시

다음은 Javascript 및 Python에서 2slides API를 사용하여 슬라이드를 생성하는 전체 예시입니다:

const API_KEY = 'sk-2slides-your-api-key-here'; const BASE_URL = 'https://2slides.com'; async function generateSlides() { try { // Step 1: Search for a theme const themeResponse = await fetch( `${BASE_URL}/api/v1/themes/search?query=timeline&limit=5`, { headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' } } ); const themeData = await themeResponse.json(); const themeId = themeData.data.themes[0].id; // Step 2: Generate slides const generateResponse = await fetch( `${BASE_URL}/api/v1/slides/generate`, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ userInput: "Create a timeline for our product development: Q1 - Research and planning, Q2 - MVP development, Q3 - Beta testing, Q4 - Public launch", themeId: themeId, responseLanguage: "English", mode: "async" }) } ); const generateData = await generateResponse.json(); const jobId = generateData.data.jobId; // Step 3: Poll for completion let jobStatus; do { await new Promise(resolve => setTimeout(resolve, 2000)); // Wait 2 seconds const statusResponse = await fetch( `${BASE_URL}/api/v1/jobs/${jobId}`, { headers: { 'Authorization': `Bearer ${API_KEY}` } } ); jobStatus = await statusResponse.json(); console.log(`Status: ${jobStatus.data.status}`); } while (jobStatus.data.status === 'processing' || jobStatus.data.status === 'pending'); // Step 4: Handle result if (jobStatus.data.status === 'success') { console.log('Slides generated successfully!'); console.log('Download URL:', jobStatus.data.downloadUrl); console.log('Pages generated:', jobStatus.data.slidePageCount); // Download the file const downloadResponse = await fetch(jobStatus.data.downloadUrl); const blob = await downloadResponse.blob(); // Create download link const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'presentation.pptx'; a.click(); window.URL.revokeObjectURL(url); } else { console.error('Generation failed:', jobStatus.data.errorMessage); } } catch (error) { console.error('Error:', error); } } // Run the example generateSlides();

Python 예시

import requests import time import json API_KEY = 'sk-2slides-your-api-key-here' BASE_URL = 'https://2slides.com' def generate_slides(): headers = { 'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json' } try: # Step 1: Search for a theme theme_response = requests.get( f'{BASE_URL}/api/v1/themes/search', params={'query': 'roadmap', 'limit': 5}, headers=headers ) theme_data = theme_response.json() theme_id = theme_data['data']['themes'][0]['id'] # Step 2: Generate slides generate_payload = { 'userInput': 'Create a product roadmap for our mobile app: Phase 1 - Core features, Phase 2 - Advanced features, Phase 3 - AI integration', 'themeId': theme_id, 'responseLanguage': 'English', 'mode': 'async' } generate_response = requests.post( f'{BASE_URL}/api/v1/slides/generate', headers=headers, json=generate_payload ) generate_data = generate_response.json() job_id = generate_data['data']['jobId'] # Step 3: Poll for completion while True: time.sleep(2) # Wait 2 seconds status_response = requests.get( f'{BASE_URL}/api/v1/jobs/{job_id}', headers=headers ) status_data = status_response.json() status = status_data['data']['status'] print(f'Status: {status}') if status in ['success', 'failed']: break # Step 4: Handle result if status == 'success': print('Slides generated successfully!') print(f'Download URL: {status_data["data"]["downloadUrl"]}') print(f'Pages generated: {status_data["data"]["slidePageCount"]}') # Download the file download_response = requests.get(status_data['data']['downloadUrl']) with open('presentation.pptx', 'wb') as f: f.write(download_response.content) print('File downloaded as presentation.pptx') else: print(f'Generation failed: {status_data["data"]["errorMessage"]}') except Exception as error: print(f'Error: {error}') # Run the example generate_slides()

cURL 예시

테마 검색:

curl -X GET "https://2slides.com/api/v1/themes/search?query=timeline&limit=5" \ -H "Authorization: Bearer sk-2slides-your-api-key-here" \ -H "Content-Type: application/json"

슬라이드 생성:

curl -X POST "https://2slides.com/api/v1/slides/generate" \ -H "Authorization: Bearer sk-2slides-your-api-key-here" \ -H "Content-Type: application/json" \ -d '{ "userInput": "Create a timeline for our project milestones", "themeId": "theme-uuid-here", "responseLanguage": "English", "mode": "async" }'

작업 상태 확인:

curl -X GET "https://2slides.com/api/v1/jobs/job-uuid-here" \ -H "Authorization: Bearer sk-2slides-your-api-key-here"

오류 처리

API는 표준 HTTP 상태 코드를 사용하며 JSON 형식으로 상세한 오류 정보를 반환합니다.

일반적인 오류 응답

400 Bad Request:

{ "success": false, "error": "userInput is required and must be a non-empty string" }

401 Unauthorized:

{ "success": false, "error": "Authentication required" }

403 Forbidden:

{ "success": false, "error": "Access denied" }

404 Not Found:

{ "success": false, "error": "Theme not found" }

429 Too Many Requests:

{ "success": false, "error": "Rate limit exceeded" }

500 Internal Server Error:

{ "success": false, "error": "Internal server error" }

오류 처리 모범 사례

async function handleApiRequest(url, options) { try { const response = await fetch(url, options); const data = await response.json(); if (!response.ok) { switch (response.status) { case 400: throw new Error(`Bad Request: ${data.error}`); case 401: throw new Error('Authentication failed. Please check your API key.'); case 403: throw new Error('Access denied. You may not have permission for this resource.'); case 404: throw new Error('Resource not found.'); case 429: throw new Error('Rate limit exceeded. Please try again later.'); case 500: throw new Error('Server error. Please try again later.'); default: throw new Error(`API Error: ${data.error || 'Unknown error'}`); } } return data; } catch (error) { if (error.name === 'TypeError' && error.message.includes('fetch')) { throw new Error('Network error. Please check your internet connection.'); } throw error; } }

모범 사례

1. API 키 보안

  • 클라이언트 측 코드 또는 공개 저장소에 API 키를 절대 노출하지 마세요.
  • API 키를 안전하게 저장하려면 환경 변수를 사용하세요.
  • 보안 강화를 위해 키를 정기적으로 로테이션하세요.
  • API 관리 대시보드를 통해 키 사용량을 모니터링하세요.
  • 키를 안전하게 보관하세요: 2slides는 API 키를 저장하지 않으므로 안전하게 보관해야 합니다.
  • 키를 백업하세요: API 키를 안전한 암호 관리자 또는 암호화된 저장소에 보관하세요.

2. 효율적인 API 사용

  • 반복적인 요청을 피하기 위해 테마 검색 결과를 캐시하세요.
  • 작업 상태 확인을 위해 적절한 폴링 간격(2-5초)을 구현하세요.
  • 지수 백오프를 사용하여 Rate Limit을 우아하게 처리하세요.
  • API 호출을 줄이기 위해 가능한 경우 작업을 일괄 처리하세요.

3. 오류 처리

  • 항상 응답 상태 코드를 확인하세요.
  • 일시적인 오류에 대한 재시도 로직을 구현하세요.
  • 디버깅을 위해 오류를 적절하게 기록하세요.
  • 사용자 친화적인 오류 메시지를 제공하세요.

4. 성능 최적화

  • 불필요한 요청을 피하기 위해 적절한 폴링 간격을 사용하세요.
  • 요청이 중단되는 것을 방지하기 위해 요청 시간 초과를 구현하세요.
  • 테마 정보와 같이 자주 사용되는 데이터를 캐시하세요.
  • 예상치 못한 요금을 피하기 위해 크레딧 사용량을 모니터링하세요.

5. 콘텐츠 가이드라인

  • 더 나은 슬라이드 생성을 위해 명확하고 구조화된 입력을 제공하세요.
  • 콘텐츠 유형에 적절한 테마를 사용하세요.
  • 국제 콘텐츠의 경우 필요할 때 언어를 지정하세요.
  • 최적의 슬라이드 레이아웃을 위해 콘텐츠를 간결하게 유지하세요.

지원 및 자료

문서 및 자료

도움 받기

  • API 플레이그라운드: 2slides.com/api에서 브라우저에서 직접 API 호출을 테스트하세요.
  • 계정 대시보드: 2slides.com/account에서 크레딧 사용량을 관리하세요.
  • 지원: 메인 웹사이트를 통해 지원팀에 문의하세요.

커뮤니티 및 업데이트

  • 기능 업데이트: 새로운 기능 및 개선 사항에 대한 최신 정보를 받아보세요.
  • 템플릿 라이브러리: 새로운 전문 템플릿이 정기적으로 추가됩니다.
  • API 개선: API 성능 및 기능에 대한 지속적인 개선.

결론

2slides API는 전문적인 프레젠테이션을 프로그래밍 방식으로 생성할 수 있는 강력하고 유연한 방법을 제공합니다. 포괄적인 기능 세트, 강력한 오류 처리 및 광범위한 템플릿 라이브러리를 통해 AI 기반 슬라이드 생성을 모든 애플리케이션 또는 워크플로우에 통합할 수 있습니다.

오늘 2slides API로 멋진 프레젠테이션을 만들어보세요! 2slides.com/api를 방문하여 API 키를 받고 생성을 시작하세요.

About 2Slides

Create stunning AI-powered presentations in seconds. Transform your ideas into professional slides with 2slides AI Agent.

Try For Free