You must authenticate every request to the Adfin API. Adfin supports two methods:
- API keys. Use an API key to connect your own systems to your own Adfin account.
- OAuth 2.0. Use OAuth 2.0 to connect your platform to the Adfin accounts of your users.
Which method to use
Use an API key if you connect only your own systems to your own Adfin account.
Use OAuth 2.0 if you build an integration for more than one Adfin account.
API keys integration
Create a key in the Adfin Console. Send it with each request to access your own account.
OAuth integration
Get access tokens with your app credentials. Act for one or more Adfin accounts after their owners give consent.
| API key | OAuth 2.0 | |
|---|---|---|
| Recommended for | Connecting your own systems, such as an ERP, a script or a data warehouse, to your own Adfin account | Platforms and partners that connect to the Adfin accounts of their users |
| Accounts you can access | Only the account that created the key | Each account that gives consent to your app |
| How you get the credentials | You create the key in the Adfin Console | Your Adfin Integration Manager sends your client_id and client_secret |
| What you send with each request | The API key | An access token that expires after 1 hour |
| Lifetime | 90 days, 180 days or 12 months. You choose when you create the key | The access token expires after 1 hour. A refresh token keeps the connection for up to 1 year |
| Permissions | The permissions that you give the key | The scopes that the account owner approves |
Adfin has two environments. Credentials from one environment do not work in the other environment.
| Environment | API base URL |
|---|---|
| Staging | https://api.staging.adfin.com/api |
| Production | https://api.adfin.com/api |
Test your integration in staging before you use production.
Both methods use the HTTP Authorization header with the Bearer scheme:
Authorization: Bearer {your_access_token_or_api_key}Send all requests over HTTPS. Do not put credentials in a URL or a query parameter.