GetPartnerAccessTokens
Returns the tokens of a partner. With a partner's token you can issue documents on its behalf. A partner can have more than one token, each with its own description.
Why this call needs a password
A partner's token lets you issue legally valid documents in that partner's name. So this call needs one more layer of security than the others: on top of your email and token, it needs the password of your IPPN account's main user. It's the only call that needs it. Store the password securely, ideally on a different system from the one that makes the other API calls.
GET https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId={partnerTaxId}
Request
Header
| Parameter | Required | Value |
|---|---|---|
| required | string(50) The email of your IPPN account's main user. Example: ippn-api@yourcompany.pt | |
| Token | required | Your IPPN account's token, provided by our commercial team. |
| Password | required | The password of your IPPN account's main user. |
note
These parameters are HTTP headers.
Query
| Parameter | Required | Description |
|---|---|---|
| partnerTaxId | required | string The partner's tax id. Example: ?partnerTaxId=599138645 |
Response
| Parameter | Description |
|---|---|
| RequestId | Unique Id for the request to have a way to identify the request |
| Object | List of APIAccessTokenBase |
| - AccessToken | string The token that gives access to the partner's account. Send it as Token to issue documents on the partner's behalf. |
| - Description | string A description that tells the partner's tokens apart. |
| Type | string Description to inform if the request was a success or error. Example value: "Success" |
| ErrorValue | MagniEnum |
| - Value | int Identifies the error with a number. To identify the types of errors in more detail, click here. Example value: "16" |
| - Name | string Identifies the error with a token. Example value: "NoPartnerFoundWithTaxId" |
| ErrorHumanReadable | string Text that explains the error found. |
| ValidationErrors | List of ValidationError |
| - Type | string Identifies the error with a token. |
| - Field | string Name of the field in which validation failed. Example value: "CompanyTaxId" (when partnerTaxId is empty) |
| - ElementNumber | int Which element failed when the field repeats; 0 otherwise. Example value: 0 |
| - Detail | string Detailed error explanation. |
| IsSuccess | boolean Whether the request succeeded or not. Example value: "true" |
| IsError | boolean Whether the request failed or not. Example value: "false" |
Errors you may get
| Error | Meaning |
|---|---|
NoPartnerFoundWithTaxId | The partner isn't linked to your IPPN account with access granted. The error is the same whether the request is still pending, was rejected or revoked, or was never made. Check the state in the web interface under Config → IPPN → Partnership Management. |
InvalidTaxId | partnerTaxId isn't a valid tax id. |
WithoutMainUserPermission | The email and token aren't those of your IPPN account's main user. |
PartnershipNotFound | The token you sent isn't your IPPN account's token, or your IPPN account isn't set up correctly. |
AuthenticationError | The email, token or password is wrong. |
Request Sample
cURL
curl 'https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=599138645' \
--header 'Email: ippn-api@yourcompany.pt' \
--header 'Token: your-ippn-token' \
--header 'Password: your-ippn-password'
JavaScript (fetch)
fetch('https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=599138645', {
headers: {
Email: 'ippn-api@yourcompany.pt',
Token: 'your-ippn-token',
Password: 'your-ippn-password',
},
})
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Node.js (axios)
const axios = require('axios');
axios
.get('https://bo.magnifinance.com/api/v1.1/partner/accessTokens', {
params: { partnerTaxId: '599138645' },
headers: {
Email: 'ippn-api@yourcompany.pt',
Token: 'your-ippn-token',
Password: 'your-ippn-password',
},
})
.then((response) => console.log(response.data))
.catch((error) => console.error(error));
Python (requests)
import requests
response = requests.get(
"https://bo.magnifinance.com/api/v1.1/partner/accessTokens",
params={"partnerTaxId": "599138645"},
headers={
"Email": "ippn-api@yourcompany.pt",
"Token": "your-ippn-token",
"Password": "your-ippn-password",
},
)
print(response.json())
PHP (cURL)
<?php
$ch = curl_init("https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=599138645");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Email: ippn-api@yourcompany.pt",
"Token: your-ippn-token",
"Password: your-ippn-password"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
C# (HttpClient)
using System.Net.Http;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Email", "ippn-api@yourcompany.pt");
client.DefaultRequestHeaders.Add("Token", "your-ippn-token");
client.DefaultRequestHeaders.Add("Password", "your-ippn-password");
var response = await client.GetAsync("https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=599138645");
Console.WriteLine(await response.Content.ReadAsStringAsync());
Java (HttpClient)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=599138645"))
.header("Email", "ippn-api@yourcompany.pt")
.header("Token", "your-ippn-token")
.header("Password", "your-ippn-password")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Important Information
- Using the token: call Create Document with your own
Emailand the partner's token asToken. The document is issued in the partner's name. - Revoking a token: there's no API call for it. Revoke it in the web interface under Config → IPPN → Partnership Management. The partner can also end the partnership from its own MagniFinance account, which revokes all of your tokens for that partner.