API di TikTok
L'API di TikTok ti consente di cercare profili utente, elencare video, leggere commenti e risposte, cercare video e utenti, esplorare hashtag e navigare il grafo sociale (follower / seguiti). Undici endpoint, tutti a 1 credito per richiesta.
Endpoint
| Endpoint | Descrizione |
|---|---|
POST /api/v1/tiktok/profile | Ottieni un profilo utente tramite username o sec_user_id |
POST /api/v1/tiktok/user/posts | Elenca i video di un utente (impaginati, ordinabili) |
POST /api/v1/tiktok/video | Ottieni i dettagli completi di un singolo video |
POST /api/v1/tiktok/video/comments | Elenca i commenti su un video |
POST /api/v1/tiktok/video/comments/replies | Elenca le risposte a un commento specifico |
POST /api/v1/tiktok/search/videos | Cerca video su TikTok per parola chiave |
POST /api/v1/tiktok/search/users | Cerca utenti su TikTok per parola chiave |
POST /api/v1/tiktok/hashtag | Ottieni dettagli e statistiche di un hashtag |
POST /api/v1/tiktok/hashtag/videos | Elenca i video per un hashtag |
POST /api/v1/tiktok/user/followers | Elenca i follower di un utente |
POST /api/v1/tiktok/user/followings | Elenca gli account seguiti da un utente |
Autenticazione
| Intestazione | Valore | Obbligatorio |
|---|---|---|
Authorization | Bearer YOUR_API_KEY | Sì |
Content-Type | application/json | Sì |
Ogni risposta di successo include campi di tracciamento dei crediti: credits_used, credits_remaining e response_time (ms).
Ottenere un sec_user_id
La maggior parte degli endpoint richiede un sec_user_id invece di un username. Chiama prima l'endpoint Profilo con un username, poi usa data.user.sec_uid per le richieste successive.
Profilo Utente
POST https://api.scavio.dev/api/v1/tiktok/profileOttieni un profilo utente TikTok. Passa o username o sec_user_id.
Corpo della Richiesta
| Parametro | Tipo | Predefinito | Descrizione |
|---|---|---|---|
username | string | -- | Handle TikTok (senza @). Uno tra username o sec_user_id obbligatorio. |
sec_user_id | string | -- | ID utente sicuro. Uno tra username o sec_user_id obbligatorio. |
Esempio
curl -X POST 'https://api.scavio.dev/api/v1/tiktok/profile' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"username": "tiktok"}'Campi della Risposta (data.user)
| Campo | Tipo | Descrizione |
|---|---|---|
unique_id | string | Username (handle) |
nickname | string | Nome visualizzato |
sec_uid | string | ID utente sicuro (usa per altri endpoint) |
uid | string | ID utente numerico |
signature | string | Testo biografia |
bio_url | string | Link nella biografia |
follower_count | number | Follower |
following_count | number | Seguiti |
aweme_count | number | Video totali pubblicati |
total_favorited | number | Mi piace totali ricevuti |
avatar_larger | object | Immagine avatar (.url_list[0] per URL) |
Esempio di Risposta
{
"data": {
"user": {
"unique_id": "tiktok",
"nickname": "TikTok",
"sec_uid": "MS4wLjABAAAAv7iSuuXDJGDvJkmH_vz1qkDZYo1apxgzaxdBSeIuPiM",
"uid": "107955",
"signature": "One TikTok can make a big impact",
"bio_url": "linktr.ee/tiktok",
"follower_count": 94015018,
"following_count": 1,
"aweme_count": 1510,
"total_favorited": 457945663
}
},
"response_time": 1245,
"credits_used": 1,
"credits_remaining": 11753
}Post dell'Utente
POST https://api.scavio.dev/api/v1/tiktok/user/postsElenca i video di un utente. Richiede sec_user_id (ottienilo dall'endpoint profilo).
Corpo della Richiesta
| Parametro | Tipo | Predefinito | Descrizione |
|---|---|---|---|
sec_user_id | string | -- | Obbligatorio. ID utente sicuro dall'endpoint profilo. |
cursor | string | "0" | Cursore di impaginazione. Usa data.max_cursor dalla risposta precedente. |
count | number | 20 | Risultati per pagina (1-30). |
sort_type | string | "0" | "0" = più recenti, "1" = popolari. |
Impaginazione
Usa data.max_cursor come cursor nella richiesta successiva. Fermati quando data.has_more è 0.
Campi Video (data.aweme_list[])
| Campo | Tipo | Descrizione |
|---|---|---|
aweme_id | string | ID video |
desc | string | Didascalia video |
create_time | number | Timestamp Unix (secondi) |
statistics.digg_count | number | Mi piace |
statistics.comment_count | number | Commenti |
statistics.play_count | number | Visualizzazioni |
statistics.share_count | number | Condivisioni |
statistics.collect_count | number | Segnalibri |
author | object | Informazioni autore (sottoinsieme del profilo) |
music | object | Suono utilizzato |
video | object | URL video, dimensioni, durata |
Dettaglio Video
POST https://api.scavio.dev/api/v1/tiktok/videoOttieni i dettagli completi di un singolo video.
Corpo della Richiesta
| Parametro | Tipo | Predefinito | Descrizione |
|---|---|---|---|
video_id | string | -- | Obbligatorio. ID video TikTok. |
Esempio
curl -X POST 'https://api.scavio.dev/api/v1/tiktok/video' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"video_id": "7350810998023949599"}'Campi Aggiuntivi (data.aweme_detail)
Include tutti i campi video elencati sopra, più:
| Campo | Tipo | Descrizione |
|---|---|---|
video.play_addr | object | URL di riproduzione video (.url_list[0]) |
video.download_addr | object | URL di download (senza watermark) |
video.cover | object | Immagine di copertina |
video.duration | number | Durata in ms |
cha_list | array | Hashtag utilizzati |
text_extra | array | Menzioni e hashtag nella didascalia |
Esempio di Risposta
{
"data": {
"aweme_detail": {
"aweme_id": "7350810998023949599",
"desc": "im so sick of being tired im so tired of being sick",
"create_time": 1711494099,
"statistics": {
"digg_count": 2002382,
"comment_count": 8119,
"play_count": 12171757,
"share_count": 274978,
"collect_count": 211332
}
}
},
"response_time": 1605,
"credits_used": 1,
"credits_remaining": 11752
}Commenti del Video
POST https://api.scavio.dev/api/v1/tiktok/video/commentsOttieni i commenti su un video.
Corpo della Richiesta
| Parametro | Tipo | Predefinito | Descrizione |
|---|---|---|---|
video_id | string | -- | Obbligatorio. ID video. |
cursor | string | "0" | Cursore di impaginazione. |
count | number | 20 | Risultati per pagina (1-50). |
Impaginazione
Usa data.cursor come prossimo cursore. Fermati quando data.has_more è 0.
Campi Commento (data.comments[])
| Campo | Tipo | Descrizione |
|---|---|---|
cid | string | ID commento (usa per endpoint risposte) |
text | string | Testo del commento |
create_time | number | Timestamp Unix (secondi) |
digg_count | number | Mi piace su questo commento |
reply_comment_total | number | Numero di risposte |
user | object | Informazioni commentatore (nickname, avatar, ecc.) |
is_author_digged | number | 1 se l'autore del video ha messo mi piace a questo commento |
Risposte ai Commenti
POST https://api.scavio.dev/api/v1/tiktok/video/comments/repliesOttieni le risposte a un commento specifico.
Corpo della Richiesta
| Parametro | Tipo | Predefinito | Descrizione |
|---|---|---|---|
video_id | string | -- | Obbligatorio. ID video. |
comment_id | string | -- | Obbligatorio. ID commento (cid dall'endpoint commenti). |
cursor | string | "0" | Cursore di impaginazione. |
count | number | 20 | Risultati per pagina (1-50). |
Impaginazione
Come per i commenti: usa data.cursor, fermati quando data.has_more è 0. Ogni risposta ha gli stessi campi di un oggetto commento.
Cerca Video
POST https://api.scavio.dev/api/v1/tiktok/search/videosCerca video su TikTok per parola chiave.
Corpo della Richiesta
| Parametro | Tipo | Predefinito | Descrizione |
|---|---|---|---|
keyword | string | -- | Obbligatorio. Query di ricerca (1-500 caratteri). |
cursor | string | "0" | Offset di impaginazione. |
count | number | 20 | Risultati per pagina (1-30). |
sort_type | string | "0" | "0" = pertinenza, "1" = più mi piace. |
publish_time | string | "0" | "0" = sempre, "1" = ultimo giorno, "7" = settimana, "30" = mese, "90" = 3 mesi, "180" = 6 mesi. |
Esempio
curl -X POST 'https://api.scavio.dev/api/v1/tiktok/search/videos' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"keyword": "cooking recipe", "count": 10, "publish_time": "7"}'Impaginazione
Usa data.cursor come prossimo cursor. Fermati quando data.has_more è 0. Ogni elemento in data.aweme_list ha la stessa struttura di un dettaglio video.
Cerca Utenti
POST https://api.scavio.dev/api/v1/tiktok/search/usersCerca utenti su TikTok per parola chiave.
Corpo della Richiesta
| Parametro | Tipo | Predefinito | Descrizione |
|---|---|---|---|
keyword | string | -- | Obbligatorio. Query di ricerca (1-500 caratteri). |
cursor | string | "0" | Offset di impaginazione. |
count | number | 20 | Risultati per pagina (1-30). |
Campi della Risposta (data.user_list[].user_info)
| Campo | Tipo | Descrizione |
|---|---|---|
uid | string | ID utente |
unique_id | string | Username |
nickname | string | Nome visualizzato |
sec_uid | string | ID utente sicuro |
follower_count | number | Follower |
signature | string | Biografia |
Informazioni Hashtag
POST https://api.scavio.dev/api/v1/tiktok/hashtagOttieni dettagli e statistiche di un hashtag. Passa o hashtag_name o hashtag_id.
Corpo della Richiesta
| Parametro | Tipo | Predefinito | Descrizione |
|---|---|---|---|
hashtag_name | string | -- | Testo hashtag (senza #). Uno tra hashtag_name o hashtag_id obbligatorio. |
hashtag_id | string | -- | ID hashtag numerico. Uno tra hashtag_name o hashtag_id obbligatorio. |
Campi della Risposta
| Campo | Tipo | Descrizione |
|---|---|---|
data.challengeInfo.challenge.id | string | ID hashtag (usa per video hashtag) |
data.challengeInfo.challenge.title | string | Nome hashtag |
data.challengeInfo.challenge.desc | string | Descrizione |
data.challengeInfo.stats.videoCount | number | Numero di video |
data.challengeInfo.stats.viewCount | number | Visualizzazioni totali |
Esempio di Risposta
{
"data": {
"challengeInfo": {
"challenge": {
"id": "229207",
"title": "fyp",
"desc": "",
"stats": {
"videoCount": 0,
"viewCount": 118798000000000
}
}
}
},
"response_time": 892,
"credits_used": 1,
"credits_remaining": 11751
}Video per Hashtag
POST https://api.scavio.dev/api/v1/tiktok/hashtag/videosElenca i video per un hashtag. Richiede hashtag_id (ottienilo dall'endpoint informazioni hashtag).
Corpo della Richiesta
| Parametro | Tipo | Predefinito | Descrizione |
|---|---|---|---|
hashtag_id | string | -- | Obbligatorio. Dall'endpoint informazioni hashtag. |
cursor | string | "0" | Cursore di impaginazione. |
count | number | 20 | Risultati per pagina (1-30). |
Impaginazione
Usa data.cursor come prossimo cursore. Fermati quando data.has_more è 0. La risposta contiene data.aweme_list[] con la stessa struttura video di ricerca e post utente.
Follower Utente
POST https://api.scavio.dev/api/v1/tiktok/user/followersOttieni la lista dei follower di un utente.
Corpo della Richiesta
| Parametro | Tipo | Predefinito | Descrizione |
|---|---|---|---|
sec_user_id | string | -- | Obbligatorio. Dall'endpoint profilo. |
count | number | 20 | Risultati per pagina (1-20). |
page_token | string | -- | Dalla risposta precedente data.next_page_token. |
min_time | number | -- | Dalla risposta precedente data.min_time. |
Impaginazione
Passa sia page_token che min_time dalla risposta precedente. Fermati quando data.has_more è false.
Campi Follower (data.followers[])
| Campo | Tipo | Descrizione |
|---|---|---|
unique_id | string | Username |
nickname | string | Nome visualizzato |
sec_uid | string | ID utente sicuro |
uid | string | ID utente |
follower_count | number | Il loro numero di follower |
aweme_count | number | Il loro numero di video |
signature | string | La loro biografia |
avatar_thumb | object | Avatar (.url_list[0]) |
Seguiti Utente
POST https://api.scavio.dev/api/v1/tiktok/user/followingsOttieni gli account che un utente segue. Stessa forma e parametri della richiesta dei follower. La risposta usa data.followings[] invece di data.followers[].
Riferimento Impaginazione
| Stile | Endpoint | Pagina successiva | Condizione di arresto |
|---|---|---|---|
| Cursore (stringa) | user/posts | cursor = data.max_cursor | data.has_more === 0 |
| Offset (numero) | search/*, hashtag/videos, video/comments, video/comments/replies | cursor = data.cursor | data.has_more === 0 |
| Token + tempo | user/followers, user/followings | page_token + min_time | data.has_more === false |
Note
- Tutti i campi
create_timesono timestamp Unix in secondi. Moltiplica per 1000 per JavaScriptDate. - I campi avatar e immagine restituiscono un oggetto con un array
url_list. Usa.url_list[0]per l'URL. - Vedi Errori per la gestione di
401,429e502.