gitbook-1-api-authentication
Sub-skill of gitbook: 1. API Authentication (+1).
Best use case
gitbook-1-api-authentication is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Sub-skill of gitbook: 1. API Authentication (+1).
Teams using gitbook-1-api-authentication should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/1-api-authentication/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How gitbook-1-api-authentication Compares
| Feature / Agent | gitbook-1-api-authentication | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Sub-skill of gitbook: 1. API Authentication (+1).
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 1. API Authentication (+1)
## 1. API Authentication
**REST API Basics:**
```bash
# GitBook API base URL
API_BASE="https://api.gitbook.com/v1"
# Get current user
curl -s -H "Authorization: Bearer $GITBOOK_API_TOKEN" \
"$API_BASE/user" | jq
# List organizations
curl -s -H "Authorization: Bearer $GITBOOK_API_TOKEN" \
"$API_BASE/orgs" | jq
# Get organization details
curl -s -H "Authorization: Bearer $GITBOOK_API_TOKEN" \
"$API_BASE/orgs/ORG_ID" | jq
```
**Python API Client:**
```python
import requests
from datetime import datetime
import os
class GitBookClient:
"""GitBook API client."""
BASE_URL = "https://api.gitbook.com/v1"
def __init__(self, api_token=None):
self.api_token = api_token or os.environ.get("GITBOOK_API_TOKEN")
self.headers = {
"Authorization": f"Bearer {self.api_token}",
"Content-Type": "application/json"
}
def _request(self, method, endpoint, data=None, params=None):
"""Make API request."""
url = f"{self.BASE_URL}{endpoint}"
response = requests.request(
method,
url,
headers=self.headers,
json=data,
params=params
)
response.raise_for_status()
return response.json() if response.text else None
def get_user(self):
"""Get current user."""
return self._request("GET", "/user")
def list_organizations(self):
"""List all organizations."""
return self._request("GET", "/orgs")
def get_organization(self, org_id):
"""Get organization details."""
return self._request("GET", f"/orgs/{org_id}")
# Example usage
if __name__ == "__main__":
client = GitBookClient()
user = client.get_user()
print(f"User: {user['displayName']}")
orgs = client.list_organizations()
for org in orgs.get("items", []):
print(f"Org: {org['title']}")
```
## 2. Spaces Management
**REST API - Spaces:**
```bash
# List spaces in organization
curl -s -H "Authorization: Bearer $GITBOOK_API_TOKEN" \
"$API_BASE/orgs/ORG_ID/spaces" | jq
# Get space details
curl -s -H "Authorization: Bearer $GITBOOK_API_TOKEN" \
"$API_BASE/spaces/SPACE_ID" | jq
# Create space
curl -s -X POST -H "Authorization: Bearer $GITBOOK_API_TOKEN" \
-H "Content-Type: application/json" \
"$API_BASE/orgs/ORG_ID/spaces" \
-d '{
"title": "API Documentation",
"visibility": "public"
}' | jq
# Update space
curl -s -X PATCH -H "Authorization: Bearer $GITBOOK_API_TOKEN" \
-H "Content-Type: application/json" \
"$API_BASE/spaces/SPACE_ID" \
-d '{
"title": "Updated API Documentation",
"visibility": "private"
}' | jq
# Delete space
curl -s -X DELETE -H "Authorization: Bearer $GITBOOK_API_TOKEN" \
"$API_BASE/spaces/SPACE_ID"
# Get space content (pages)
curl -s -H "Authorization: Bearer $GITBOOK_API_TOKEN" \
"$API_BASE/spaces/SPACE_ID/content" | jq
```
**Python - Spaces:**
```python
class GitBookClient:
# ... previous methods ...
def list_spaces(self, org_id):
"""List all spaces in organization."""
return self._request("GET", f"/orgs/{org_id}/spaces")
def get_space(self, space_id):
"""Get space details."""
return self._request("GET", f"/spaces/{space_id}")
def create_space(self, org_id, title, visibility="public"):
"""Create a new space."""
return self._request(
"POST",
f"/orgs/{org_id}/spaces",
data={"title": title, "visibility": visibility}
)
def update_space(self, space_id, **kwargs):
"""Update space settings."""
return self._request(
"PATCH",
f"/spaces/{space_id}",
data=kwargs
)
def delete_space(self, space_id):
"""Delete a space."""
return self._request("DELETE", f"/spaces/{space_id}")
def get_space_content(self, space_id):
"""Get space content structure."""
return self._request("GET", f"/spaces/{space_id}/content")
# Example usage
spaces = client.list_spaces("org_xxxxx")
for space in spaces.get("items", []):
print(f"Space: {space['title']} ({space['visibility']})")
# Create new space
new_space = client.create_space(
org_id="org_xxxxx",
title="Developer Guide",
visibility="public"
)
print(f"Created: {new_space['id']}")
```Related Skills
google-earth-engine-11-authentication
Sub-skill of google-earth-engine: 1.1 Authentication (+2).
sparc-specification-21-authentication
Sub-skill of sparc-specification: 2.1 Authentication (+1).
github-modes-1-authentication
Sub-skill of github-modes: 1. Authentication (+3).
gitbook-user-guide
Sub-skill of gitbook: User Guide.
gitbook-github-actions-for-git-sync
Sub-skill of gitbook: GitHub Actions for Git Sync (+1).
gitbook-getting-started
Sub-skill of gitbook: Getting Started.
gitbook-example-1-documentation-site-builder
Sub-skill of gitbook: Example 1: Documentation Site Builder (+2).
gitbook-api-reference
Sub-skill of gitbook: API Reference.
gitbook-5-content-variants-versions
Sub-skill of gitbook: 5. Content Variants (Versions) (+1).
gitbook-3-content-management
Sub-skill of gitbook: 3. Content Management (+1).
gitbook-1-structure-content-properly
Sub-skill of gitbook: 1. Structure Content Properly (+3).
dash-6-authentication
Sub-skill of dash: 6. Authentication.