support/doc/api/quickstart.md
There are several ways to know if a website uses the PeerTube software:
x-powered-by: PeerTube header response to API requests<meta property="og:platform" content="PeerTube"> tagSome endpoints need authentication. We use OAuth 2.0 so first fetch the client tokens:
::: code-group
curl https://peertube.example.com/api/v1/oauth-clients/local
const { client_id, client_secret } = await fetch('https://peertube.example.com/api/v1/oauth-clients/local', {
headers: { 'Content-Type': 'application/json' }
}).then(res => res.json())
:::
Response example:
{
"client_id": "v1ikx5hnfop4mdpnci8nsqh93c45rldf",
"client_secret": "AjWiOapPltI6EnsWQwlFarRtLh4u8tDt"
}
Now you can fetch the user token:
::: code-group
curl -X POST \
-d "client_id=v1ikx5hnfop4mdpnci8nsqh93c45rldf&client_secret=AjWiOapPltI6EnsWQwlFarRtLh4u8tDt&grant_type=password&response_type=code&username=your_user&password=your_password" \
https://peertube.example.com/api/v1/users/token
const { access_token } = await fetch('https://peertube.example.com/api/v1/users/token', {
contentType: 'application/x-www-form-urlencoded',
method: 'POST',
body: new URLSearchParams({
client_id: '...',
client_secret: '...',
username: '...',
password: '...',
grant_type: 'password'
})
}).then(res => res.json())
:::
Response example:
{
"access_token": "90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0",
"token_type": "Bearer",
"expires_in": 14399,
"refresh_token": "2e0d675df9fc96d2e4ec8a3ebbbf45eca9137bb7"
}
Just use the access_token in the Authorization header:
curl -H 'Authorization: Bearer 90286a0bdf0f7315d9d3fe8dabf9e1d2be9c97d0' https://peertube.example.com/api/v1/jobs/completed
curl https://peertube.example.com/api/v1/videos
Convenience libraries are generated automatically from the OpenAPI specification for the following languages:
Other languages supported by the OpenAPI generator can be added to the generation, provided they make a common enough use case.