Skip to main content

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​

ParameterRequiredValue
Emailrequiredstring(50) The email of your IPPN account's main user. Example: ippn-api@yourcompany.pt
TokenrequiredYour IPPN account's token, provided by our commercial team.
PasswordrequiredThe password of your IPPN account's main user.
note

These parameters are HTTP headers.

Query​

ParameterRequiredDescription
partnerTaxIdrequiredstring The partner's tax id. Example: ?partnerTaxId=599138645

Response​

ParameterDescription
RequestIdUnique Id for the request to have a way to identify the request
ObjectList of APIAccessTokenBase
- AccessTokenstring The token that gives access to the partner's account. Send it as Token to issue documents on the partner's behalf.
- Descriptionstring A description that tells the partner's tokens apart.
Typestring Description to inform if the request was a success or error. Example value: "Success"
ErrorValueMagniEnum
- Valueint Identifies the error with a number. To identify the types of errors in more detail, click here. Example value: "16"
- Namestring Identifies the error with a token. Example value: "NoPartnerFoundWithTaxId"
ErrorHumanReadablestring Text that explains the error found.
ValidationErrorsList of ValidationError
- Typestring Identifies the error with a token.
- Fieldstring Name of the field in which validation failed. Example value: "CompanyTaxId" (when partnerTaxId is empty)
- ElementNumberint Which element failed when the field repeats; 0 otherwise. Example value: 0
- Detailstring Detailed error explanation.
IsSuccessboolean Whether the request succeeded or not. Example value: "true"
IsErrorboolean Whether the request failed or not. Example value: "false"

Errors you may get​

ErrorMeaning
NoPartnerFoundWithTaxIdThe 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.
InvalidTaxIdpartnerTaxId isn't a valid tax id.
WithoutMainUserPermissionThe email and token aren't those of your IPPN account's main user.
PartnershipNotFoundThe token you sent isn't your IPPN account's token, or your IPPN account isn't set up correctly.
AuthenticationErrorThe 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 Email and the partner's token as Token. 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.