Skip to main content

GetPartnerAccessTokens

Returns the tokens of a partner company. With a partner's token you can invoice 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 operation that needs it. Store the password securely, ideally on a different system from the one that makes the other API calls.

POST https://bo.magnifinance.com/MagniAPI/Invoicing.asmx

Sample Body​

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://MagniAPI/Invoicing/">
<soapenv:Header/>
<soapenv:Body>
<inv:GetPartnerAccessTokens>
<inv:SpecialAuthentication>
<inv:Email>ippn-api@yourcompany.pt</inv:Email>
<inv:Token>your-ippn-token</inv:Token>
<inv:Password>your-ippn-password</inv:Password>
</inv:SpecialAuthentication>
<inv:PartnerTaxId>992281008</inv:PartnerTaxId>
</inv:GetPartnerAccessTokens>
</soapenv:Body>
</soapenv:Envelope>

Request​

ParameterRequiredValue
Content-Typerequiredtext/xml; charset=utf-8
SOAPActionoptional"http://MagniAPI/Invoicing/GetPartnerTokens"
note

This operation's SOAPAction is …/GetPartnerTokens, not …/GetPartnerAccessTokens. Clients generated from the WSDL already use the right value; if you set the header by hand, use the one above or leave the header out.

Body​

SpecialAuthentication​

ParameterRequiredDescription
Emailrequiredstring(50) The email of your main IPPN API user.
Tokenrequiredstring(50) Your IPPN account's token.
Passwordrequiredstring(200) That user's password.

Parameters​

ParameterRequiredDescription
PartnerTaxIdrequiredstring(20) The tax id of the partner company whose tokens you want. Example: "992281008"

Response​

The result is in <ResponseGetPartnerAccessTokens>; see Response Format for the fields every response has. Object is a list of APIAccessTokenBase:

ParameterDescription
AccessTokenstring The token that gives access to the partner company. Send it as Token in Authentication to invoice on the partner's behalf.
Descriptionstring A description that tells the partner's tokens apart.
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​

Save the Sample Body as request.xml, then:

cURL​

curl https://bo.magnifinance.com/MagniAPI/Invoicing.asmx \
--header 'Content-Type: text/xml; charset=utf-8' \
--header 'SOAPAction: "http://MagniAPI/Invoicing/GetPartnerTokens"' \
--data-binary @request.xml

JavaScript (Node.js 18+)​

const fs = require('fs');

const body = fs.readFileSync('request.xml', 'utf8');

fetch('https://bo.magnifinance.com/MagniAPI/Invoicing.asmx', {
method: 'POST',
headers: {
'Content-Type': 'text/xml; charset=utf-8',
SOAPAction: '"http://MagniAPI/Invoicing/GetPartnerTokens"',
},
body,
})
.then((response) => response.text())
.then((xml) => console.log(xml))
.catch((error) => console.error(error));

Node.js (axios)​

const fs = require('fs');
const axios = require('axios');

const body = fs.readFileSync('request.xml', 'utf8');

axios
.post('https://bo.magnifinance.com/MagniAPI/Invoicing.asmx', body, {
headers: {
'Content-Type': 'text/xml; charset=utf-8',
SOAPAction: '"http://MagniAPI/Invoicing/GetPartnerTokens"',
},
})
.then((response) => console.log(response.data))
.catch((error) => console.error(error));

Important Information​

  • Using the token: call DocumentCreate and send the partner's token as Token in Authentication (with your own Email). The document is then created on behalf of the partner.
  • Revoking a token: there's no API operation 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.