Skip to main content

GetPartnerAccessTokens

The GetPartnerAccessTokens gives access to all the partner tokens that give you access to invoicing on behalf of them. A partner can be allocated with more than one token. This allows a partner to be identified in more than one identifier, if needed.

Important

This is the only method that requires the password of the main API user of IPPN service. Passwords must be securely stored, ideally on a separate system from the system used for the rest of the operations.

GET https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId={partnerTaxId}

Request

ParameterRequiredValue
Emailrequiredstring(50) The email address of the owner of the IPPN service with specific permissions to use IPPN services. Example: api@example.com
TokenrequiredThe token for the IPPN account is specific to your IPPN service and is provided by our commercial team.
PasswordrequiredThe password of the user that was set up to be the main user of your IPPN service.
note

*These parameters must be HTTP headers within the request.

Query

ParameterRequiredDescription
partnerTaxIdrequiredint Tax id of the partner organization whose tokens will be retrieved. Example value: "599138645". In the REST API you should request as a query string parameter in the URL. Example: ?partnerTaxId=599138645

Response

ParameterDescription
RequestIdUnique Id for the request to have a way to identify the request
ObjectList of APIAccessTokenBase
- AccessTokenstring Security token that provides access to the requested partner organization's subscription.
- Descriptionstring Description that can be used to differentiate between tokens.
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: "38"
- Namestring Identifies the error with a token. Example value: "PartnershipNotFound"
ErrorHumanReadablestring Text that explains the error found. Example value: "ValidationError"
ValidationErrorsList of ValidationError
- Typestring Identifies the error with a token. Example value: "DocumentIsADuplicate"
- Fieldstring Name of the field in which validation failed. Example value: "DocumentDetailExternalId"
- ElementNumberint Identifies index of the field in which validation failed. Example value: "67204"
- Detailstring Detailed error explanation. Example value: "Duplicate Document"
IsSuccessboolean Whether the request succeeded or not. Example value: "true"
IsErrorboolean Whether the request failed or not. Example value: "false"

Request Sample

Below you can check some examples of the REST request in some technologies.

cURL

curl --location 'https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=XXX' \
--header 'Email: XXX@example.com' \
--header 'Token: XXX' \
--header 'password: XXX'

Javascript (fetch)

var myHeaders = new Headers();
myHeaders.append("Email", "XXX@example.com");
myHeaders.append("Token", "XXX");
myHeaders.append("password", "XXX");

var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};

fetch("https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=XXX", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

NodeJs (axios)

var axios = require('axios');

var config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=XXX',
headers: {
'Email': 'XXX@example.com',
'Token': 'XXX',
'password': 'XXX'
}
};

axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});

Python (requests)

import requests

url = "https://bo.magnifinance.com/api/v1.1/partner/accessTokens"
headers = {
"Email": "XXX@example.com",
"Token": "XXX",
"password": "XXX"
}
params = {"partnerTaxId": "XXX"}

response = requests.get(url, headers=headers, params=params)
print(response.json())

PHP (cURL)

<?php
$partnerTaxId = "XXX";
$ch = curl_init("https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=" . $partnerTaxId);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Email: XXX@example.com",
"Token: XXX",
"password: XXX"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>

C# (HttpClient)

using System.Net.Http;

var client = new HttpClient();
client.DefaultRequestHeaders.Add("Email", "XXX@example.com");
client.DefaultRequestHeaders.Add("Token", "XXX");
client.DefaultRequestHeaders.Add("password", "XXX");

var response = await client.GetAsync("https://bo.magnifinance.com/api/v1.1/partner/accessTokens?partnerTaxId=XXX");
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=XXX"))
.header("Email", "XXX@example.com")
.header("Token", "XXX")
.header("password", "XXX")
.GET()
.build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

Important Information

With the token in hand, you can use it, call the DocumentCreate method, replacing the token in the authentication/header with the partnerToken (so you can create a document on behalf of the partner).