Install
First, install the AIsa CLI if you have not already:What can agents do with it?
Content research
Find videos and channels around a topic.
Trend discovery
Identify what is gaining attention on YouTube.
Competitor tracking
Monitor channels and content formats in a niche.
Topic exploration
Gather video-first evidence for research workflows.
Quick Start
Base URL
Authentication
All requests require the AIsa API key in the Authorization header:AISA_API_KEY:
Getting Your API Key
- Sign in or create an account at AIsa Console
- Navigate to your Dashboard
- Copy your API key
API Reference
YouTube Search
Query Parameters
Example: Basic Search
Example: Search with Country & Language
Example: Pagination with sp Token
Response
The API returns structured YouTube search results including video metadata, channel info, thumbnails, and pagination tokens. Note: The response structure may vary by query language. English queries typically return results in thevideos array. Some non-English queries may return results grouped in a sections array instead. Always check for both fields.
sections instead of a flat videos array:
Advanced Search Tips
YouTube’sq parameter supports the same search syntax as the YouTube search box:
Using the sp Filter Token
The sp parameter accepts YouTube’s encoded filter tokens. Common values:
You can also obtain
sp tokens from the next_page_token field in previous API responses for pagination.
Pagination
Use thenext_page_token from a response to fetch the next page of results:
Code Examples
JavaScript
Python
Python (urllib, no dependencies)
Note:urllibmay encounter 403 errors due to its default User-Agent. Usingrequests(above) is recommended. If you must useurllib, always set a custom User-Agent header.
Combining with Other AIsa APIs
One of the key advantages of AIsa is the unified API key. Use the sameAISA_API_KEY to combine YouTube search with other AIsa capabilities:
YouTube Search + LLM Summary
YouTube Search + Web Search
Notes
- All requests are pay-per-use through your AIsa balance — no separate YouTube API quota management
- The
engineparameter must always be set toyoutube - Video URLs follow the format
https://www.youtube.com/watch?v={videoId} - Channel URLs follow the format
https://www.youtube.com/channel/{channelId} - Use
next_page_tokenfrom previous responses as thespvalue for pagination - The
gl(country) parameter does not support all ISO country codes. Known unsupported values includecn(China). If you getUnsupported valueerrors, try omittingglor use a different country code - Non-English queries may return results in a
sectionsarray instead of a flatvideosarray — always handle both formats - IMPORTANT: Python
urllibmay return 403 errors due to its default User-Agent. Use therequestslibrary instead, or add a customUser-Agentheader - IMPORTANT: When using curl commands, ensure environment variables like
$AISA_API_KEYare properly expanded - IMPORTANT: When piping curl output to
jq, use-sflag and ensure the API key is set
Error Handling
Troubleshooting: API Key Issues
- Check that the
AISA_API_KEYenvironment variable is set:
- Verify the API key works with a simple test:
Troubleshooting: No Results
- Verify your query is not empty
- Try a broader search term
- If using
gl, verify the country code is supported — not all ISO codes work (e.g.,cnis unsupported). Try omittingglto test - Ensure
engine=youtubeis included in every request - Check if results are in
sectionsinstead ofvideos(common for non-English queries)
Resources
- AIsa API Documentation
- AIsa Console
- YouTube Search API Reference
- AIsa Smart Search API
- AIsa Chat Completions API
- ClawHub Skills
Get started
- Sign up at aisa.one (new accounts start with $2 free credit).
- Generate an API key from the console.
- Set your key and install the skill:
- Start a new agent session so the runtime loads the updated skill instructions.
Related
YouTube SERP
Existing SERP-oriented YouTube skill.
AIsa YouTube Search
AIsa-branded YouTube search workflow.
YouTube Search endpoint
Endpoint reference for YouTube search.