YouTube Channel ID by URL API
YouTube Channel ID by URL. HTTPS resource URLs are preferred where supported. Empty results and failures are free.
YouTube Channel ID by URL. HTTPS resource URLs are preferred where supported. Empty results and failures are free.
Open product page and API TesterEndpoint and authentication
POST https://api.goanyapi.com/api/v1/youtube/channel/id/by-urlSynchronous response, without tasks or polling. Use an API Key or supported OAuth Bearer credential. No Path or Query parameters.
Input parameters
| Parameter | Location | Type | Required | Default | Constraints and meaning |
|---|---|---|---|---|---|
| Authorization | Header | string | Yes | — | Bearer YOUR_API_KEY |
| Content-Type | Header | string | Yes | application/json | application/json |
| url | JSON body | string | Yes | — | YouTube channel HTTPS URL, @handle or UC-prefixed channel ID. No prerequisite lookup or separate charge. pattern: ^(?:@[^\s/?#]+|UC[A-Za-z0-9_-]{22}|https://(?:www.|m.)?youtube.com/(?:@[^\s/?#]+|channel/UC[A-Za-z0-9_-]{22}|(?:c|user)/[^\s/?#]+)/?(?:[?#][^\s]*)?)$ minLength: 1 |
Output fields
| Field | Type | Meaning |
|---|---|---|
| code | string | ok on success; public error code on failure |
| message | string | Status message |
| data.result | object / null | Public result; null, empty and absent values are preserved |
| data.creditsUsed | integer | Actual configured charge; zero for empty results |
| data.remainingCredits | number | Balance after settlement |
| data.result.channelId | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
| data.result.url | string | Actual business field; may be empty or absent; formatted counts are not exact integers |
This endpoint does not accept a cursor or support pagination. List length is the number returned by this request, not a total.
Request example
curl -X POST 'https://api.goanyapi.com/api/v1/youtube/channel/id/by-url' -H 'Authorization: Bearer YOUR_API_KEY' -H 'Content-Type: application/json' --data '{"url":"https://www.youtube.com/@daojie"}'Real response example
Captured from a real request. Only live data.creditsUsed and data.remainingCredits are omitted. Media and caption URLs may have expired.
{
"code": "ok",
"message": "ok",
"data": {
"result": {
"channelId": "UChXZprDT6-QPTROx1mpuyIA",
"url": "https://www.youtube.com/@daojie"
}
}
}Billing and status codes
…
Each endpoint uses its own database-configured price. Only nonempty successful results are charged; empty results and failures are free. Pages are billed separately. Missing optional titles or descriptions do not invalidate a record. Media results are empty when both video and captions are empty.
| HTTP | Meaning |
|---|---|
| 200 | Query completed; may be empty |
| 400 | Invalid JSON or parameters |
| 401 | Authentication failed |
| 402 | Insufficient credits |
| 429 | Rate limited; honor Retry-After |
| 502 | Data request failed |
| 503 | API or pricing not configured |