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.
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
Header
| Parameter | Required | Value |
|---|---|---|
| Content-Type | required | text/xml; charset=utf-8 |
| SOAPAction | optional | "http://MagniAPI/Invoicing/GetPartnerTokens" |
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
| Parameter | Required | Description |
|---|---|---|
| required | string(50) The email of your main IPPN API user. | |
| Token | required | string(50) Your IPPN account's token. |
| Password | required | string(200) That user's password. |
Parameters
| Parameter | Required | Description |
|---|---|---|
| PartnerTaxId | required | string(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:
| Parameter | Description |
|---|---|
| AccessToken | string The token that gives access to the partner company. Send it as Token in Authentication to invoice on the partner's behalf. |
| Description | string A description that tells the partner's tokens apart. |
| 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
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
TokeninAuthentication(with your ownEmail). 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.