Skip to main content

AddPartner

The AddPartner method allows you to register a new company/partner into your IPPN account. Using this method, it is possible to get access for invoicing on behalf of them.

POST https://bo.magnifinance.com/api/v1.1/partner

Sample Body

{
"CompanyTaxId": "",
"UserName": "",
"UserEmail": "",
"CompanyLegalName": "",
"CompanyAddress": "",
"CompanyCity": "",
"CompanyPostCode": "",
"CompanyCountry": "",
"UserPhone": ""
}

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.
note

*These parameters must be HTTP headers within the request.

Body

PartnerInformation

ParameterRequiredDescription
CompanyTaxIdoptionalstring(20) Partner organization's tax id. Example value: "513495886"
UserNameoptionalstring(75) Name of the contact person in the partner organization. Example value: "Joao Cardoso"
UserEmailoptionalstring(75) Email of the contact person in the partner organization. Example value: "tech-success@magnifinance.com"
UserPhoneoptionalstring(50) Phone number of the contact person in the partner organization. Example value: "999555111"
CompanyLegalNameoptionalstring(50) Partner organization's legal name. Example value: "Magni EShop Partner"
CompanyAddressoptionalstring(200) Partner organization's address. Example value: "Av. Sidonio Pais"
CompanyCityoptionalstring(50) Partner organization's city. Example value: "Lisboa"
CompanyPostCodeoptionalstring(50) Partner organization's post code. Example value: "1050-214"
CompanyCountryoptionalstring(2) Partner organization's country code. (To consult the code list for each country, access the link: ISO 3166-1 alpha-2). Example value: "pt"

Response

TypeDescription
RequestIdUnique Id for the request to have a way to identify the request
Typestring Description to inform if the request was a success or error. Example value: "Success"
ErrorValueMagniEnum
- Valuestring 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 --request POST 'https://bo.magnifinance.com/api/v1.1/partner' \
--header 'Content-Type: application/json' \
--header 'Email: XXX@example.com' \
--header 'Token: XXX' \
--data-raw '{
"CompanyTaxId": "",
"UserName": "",
"UserEmail": "",
"CompanyLegalName": "",
"CompanyAddress": "",
"CompanyCity": "",
"CompanyPostCode": "",
"CompanyCountry": "",
"UserPhone": ""
}'

Javascript (fetch)

var myHeaders = new Headers();
myHeaders.append("Email", "XXX@example.com");
myHeaders.append("Token", "XXX");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"CompanyTaxId": "",
"UserName": "",
"UserEmail": "",
"CompanyLegalName": "",
"CompanyAddress": "",
"CompanyCity": "",
"CompanyPostCode": "",
"CompanyCountry": "",
"UserPhone": ""
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

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

NodeJs (axios)

var axios = require('axios');

var data = JSON.stringify({
"CompanyTaxId": "",
"UserName": "",
"UserEmail": "",
"CompanyLegalName": "",
"CompanyAddress": "",
"CompanyCity": "",
"CompanyPostCode": "",
"CompanyCountry": "",
"UserPhone": ""
});

var config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://bo.magnifinance.com/api/v1.1/partner',
headers: {
'Email': 'XXX@example.com',
'Token': 'XXX',
'Content-Type': 'application/json'
},
data: data
};

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"
headers = {
"Email": "XXX@example.com",
"Token": "XXX",
"Content-Type": "application/json"
}
payload = {
"CompanyTaxId": "",
"UserName": "",
"UserEmail": "",
"CompanyLegalName": "",
"CompanyAddress": "",
"CompanyCity": "",
"CompanyPostCode": "",
"CompanyCountry": "",
"UserPhone": ""
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())

PHP (cURL)

<?php
$ch = curl_init("https://bo.magnifinance.com/api/v1.1/partner");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Email: XXX@example.com",
"Token: XXX",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
"CompanyTaxId" => "",
"UserName" => "",
"UserEmail" => "",
"CompanyLegalName" => "",
"CompanyAddress" => "",
"CompanyCity" => "",
"CompanyPostCode" => "",
"CompanyCountry" => "",
"UserPhone" => ""
]));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>

C# (HttpClient)

using System.Net.Http;
using System.Text;
using System.Text.Json;

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

var payload = new
{
CompanyTaxId = "",
UserName = "",
UserEmail = "",
CompanyLegalName = "",
CompanyAddress = "",
CompanyCity = "",
CompanyPostCode = "",
CompanyCountry = "",
UserPhone = ""
};

var content = new StringContent(JsonSerializer.Serialize(payload), Encoding.UTF8, "application/json");

var response = await client.PostAsync("https://bo.magnifinance.com/api/v1.1/partner", content);
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;

String payload = """
{
"CompanyTaxId": "",
"UserName": "",
"UserEmail": "",
"CompanyLegalName": "",
"CompanyAddress": "",
"CompanyCity": "",
"CompanyPostCode": "",
"CompanyCountry": "",
"UserPhone": ""
}
""";

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://bo.magnifinance.com/api/v1.1/partner"))
.header("Email", "XXX@example.com")
.header("Token", "XXX")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();

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

Important Information

When adding a partner, there are two possible scenarios:

Adding a company as a partner that has no registration in our platform

If the company is not registered on our platform, when submitting an AddPartner request our process will automatically register and associate this company with your IPPN account.

Adding a company already registered as MagniFinance client in our platform

If a company is registered on the MagniFinance platform they will receive an email and only after their approval, the partnership will be completed, and the tokens become available. You can consult the request status whenever you want in the Web Interface (Config -> IPPN -> PARTNERSHIP MANAGEMENT).

  • The first state of this request is: access requested
  • After approval by the company, the status will change to: access granted
  • When the access is granted, you can query the partner's token to be able to create documents on behalf of them. To get the tokens, you can use the GetPartnerAccessTokens endpoint.