Get started

API Endpoint

Production: https://api.alfred24.it/p2p/api/v1/
Sandbox: https://api.alfred24.it/p2p/api/sandbox/
            

The Alfred24 Point2Point API provides programmatic access to read and write shipments data. API response always returns a JSON.

To use this API, you need an account and an API Token.
Once you create an account on our platform, your login email will be your user parameter.
You can find your API Token in your Profile page. You can activate your API Token by navigating the left menu Integrazioni -> Plugin .

Create Label

                
#PHP-CURL full parameters example
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.alfred24.it/p2p/api/sandbox/createLabel',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => array(
        'user' => 'your_alfred24_username',
        'api_token' => 'your_alfred24_apitoken',
        'receptionPoint' => '868',
        'senderName' => 'John',
        'senderPhone' => '+39123456789',
        'senderEmail' => 'john@doe.com',
        'senderAddress' => 'Test street 44',
        'senderZip' => '20121',
        'senderCity' => 'Milano',
        'deliveryPoint' => '55',
        'recipientName' => 'Woody Doe',
        'recipientPhone' => '+39123456789',
        'recipientEmail' => 'woody@doe.com',
        'recipientAddress' => 'Another test street 22',
        'recipientZip' => '80121',
        'recipientCity' => 'Napoli',
        'parcelWeight' => '1200',
        'parcelHeight' => '10',
        'parcelWidth' => '5',
        'parcelLength' => '7',
        'note' => 'this is a test',
        'printFormat' => 'A4',
        'digital' => '1',
        'customLogo' => 'my_company_name',
        'lang' => 'it'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
                
            

To create a new label you need to make a POST request to : createLabel


Success response:
                
{
    "response": 200,
    "result": {
        "barcode": "ALFRED6436340855XXXX",
        "label": {
            "digital": "data:image/png;base64,iVBORw0KGgoA...",
            "pdf": "JVBERi0xLjcKMSAwIG9iago8PCAvVHlwZSAvQ2..."
        }
    }
}

                
Error response:              
                
{
    "response": 400,
    "error": "error_code",
    "message": "error_description"
}
                  
            

QUERY PARAMETERS

Field Type Required Description
user String Yes Your Alfred24 account login (email)
api_token String Yes Your Alfred24 API Token.
receptionPoint Integer Yes ID of the Point chosen by sender (obtainable from getPoints)
senderName String Yes Sender Name
senderPhone String Yes Sender phone number. With or without prefix.
senderEmail String Yes Sender email
senderAddress String Yes Sender address, house number included.
senderZip String Yes Sender zip code
senderCity String Yes Sender city
deliveryPoint String Yes ID of the Point chosen by recipient (obtainable from getPoints)
recipientName String Yes Recipient Name
recipientPhone String Yes Recipient phone number. With or without prefix.
recipientEmail String Yes Recipient email
recipientAddress String Yes Recipient address, house number included
recipientZip String Yes Recipient zip code
recipientCity String Yes Recipient city
parcelWeight Integer Yes Parcel weight, in grams
parcelHeight Integer Yes Parcel height, in centimeters
parcelWidth Integer Yes parcel width, in centimeters
parcelLength Integer Yes parcel Length, in centimeters
note string No Notes
printFormat string No PDF Label print format. If not specified, default A4 format will be applied. Available: A4, A6.
digital Integer No If specified, a QR code will be provided.
customLogo string No A custom logo to add on the PDF label. Max height: 70px. You have to contact us before using this feature.
lang string No Errors responses language. Default is english. Available: en, it


RESPONSE PARAMETERS

Field Response Description
response 200 if success, 400 if error
barcode 200 Generated barcode number
digital 200 Generated QR code, if specified in query parameters. It is in base64 format, ready to use for a src attribute
pdf 200 PDF label in base64 format
error 400 Error code. Check Errors for more details.
message 400 Error description. Language used is based on lang parameter. Default: en

Delete Label

                
#PHP-CURL full parameters example
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.alfred24.it/p2p/api/sandbox/deleteLabel',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => array(
        'user' => 'your_alfred24_username',
        'api_token' => 'your_alfred24_apitoken',
        'barcode' => 'ALFRED6436340855XXXX',
        'lang' => 'en'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
                
            

To delete a label you need to make a POST request to : deleteLabel.
It's NOT possible to use this call if the shipment has been scanned by the Point / has not the state NEW.


Success response:
                
{
    "response": 200,
    "result": 1
}

                
Error response:              
                
{
    "response": 400,
    "error": "error_code",
    "message": "error_description"
}
                  
            

QUERY PARAMETERS

Field Type Required Description
user String Yes Your Alfred24 account login (email)
api_token String Yes Your Alfred24 API Token.
barcode String Yes The barcode associated to the label you want to cancel
lang String No Errors responses language. Default is english. Available: en, it


RESPONSE PARAMETERS

Field Response Description
response 200 if success, 400 if error
result 200 1, if cancellation succeeded.
error 400 Error code. Check Errors for more details.
message 400 Error description. Language used is based on lang parameter. Default: en

Return Label

                
#PHP-CURL full parameters example
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.alfred24.it/p2p/api/sandbox/returnLabel',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => array(
        'user' => 'your_alfred24_username',
        'api_token' => 'your_alfred24_apitoken',
        'receptionPoint' => '868',
        'senderName' => 'John',
        'senderPhone' => '+39123456789',
        'senderEmail' => 'john@doe.com',
        'senderAddress' => 'Test street 44',
        'senderZip' => '20121',
        'senderCity' => 'Milano',
        'parcelWeight' => '1200',
        'parcelHeight' => '10',
        'parcelWidth' => '5',
        'parcelLength' => '7',
        'note' => 'this is a test',
        'printFormat' => 'A4',
        'digital' => '1',
        'customLogo' => 'my_company_name',
        'lang' => 'it'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
                
            

To create a return label you need to make a POST request to : returnLabel.


Success response:
                
{
    "response": 200,
    "result": {
        "barcode": "ALFRED6436340855XXXX",
        "label": {
            "digital": "data:image/png;base64,iVBORw0KGgoA...",
            "pdf": "JVBERi0xLjcKMSAwIG9iago8PCAvVHlwZSAvQ2..."
        }
    }
}

                
Error response:              
                
{
    "response": 400,
    "error": "error_code",
    "message": "error_description"
}
                  
            

QUERY PARAMETERS

Field Type Required Description
user String Yes Your Alfred24 account login (email)
api_token String Yes Your Alfred24 API Token.
receptionPoint Integer Yes ID of the Point chosen by sender (obtainable from getPoints)
senderName String Yes Sender Name
senderPhone String Yes Sender phone number. With or without prefix.
senderEmail String Yes Sender email
senderAddress String Yes Sender address, house number included.
senderZip String Yes Sender zip code
senderCity String Yes Sender city
parcelWeight Integer Yes Parcel weight, in grams
parcelHeight Integer Yes Parcel height, in centimeters
parcelWidth Integer Yes parcel width, in centimeters
parcelLength Integer Yes parcel Length, in centimeters
note string No Notes
printFormat string No PDF Label print format. If not specified, default A4 format will be applied. Available: A4, A6.
digital Integer No If specified, a QR code will be provided.
customLogo string No A custom logo to add on the PDF label. Max height: 70px. You have to contact us before using this feature.
lang string No Errors responses language. Default is english. Available: en, it

Tracking

                
#PHP-CURL full parameters example
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.alfred24.it/p2p/api/sandbox/tracking',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => array(
        'barcode' => 'ALFRED6436340855XXXX',
        'lang' => 'en'
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
                
            

To get the label tracking you need to make a POST request to : tracking.
If success, the response returns statuses ordered by descending date.


Success response:
                
{
    "response": 200,
    "result":  {
        "tracking": [
            {
                "code": "P2POK",
                "status": "DELIVERED",
                "date": "2022-06-16 17:15:18",
                "locationPoint": null,
                "locationAddress": null,
                "locationCity": null,
                "locationZip": null
            },
            {
                "code": "P2P07",
                "status": "AVAILABLE AT THE POINT",
                "date": "2022-06-16 17:10:08",
                "locationPoint": "Alfred24 Tech S.r.l.",
                "locationAddress": "Via Jacopo Linussio",
                "locationCity": "Udine",
                "locationZip": "33100"
            },
            {
                "code": "P2P04",
                "status": "IN TRANSIT",
                "date": "2022-06-16 17:07:30",
                "locationPoint": null,
                "locationAddress": null,
                "locationCity": null,
                "locationZip": null
            },
            {
                "code": "P2P05",
                "status": "PICKED UP FROM THE POINT",
                "date": "2022-06-16 17:05:51",
                "locationPoint": null,
                "locationAddress": null,
                "locationCity": null,
                "locationZip": null
            },
            {
                "code": "P2P03",
                "status": "IN STOCK AT THE POINT",
                "date": "2022-06-16 17:04:27",
                "locationPoint": "Alfred24 Tech S.r.l.",
                "locationAddress": "Via Jacopo Linussio",
                "locationCity": "Udine",
                "locationZip": "33100"
            },
            {
                "code": "P2P01",
                "status": "NEW",
                "date": "2022-06-15 12:34:37",
                "locationPoint": null,
                "locationAddress": null,
                "locationCity": null,
                "locationZip": null
            }
        ]
    }
}

                
Error response:              
                
{
    "response": 400,
    "error": "error_code",
    "message": "error_description"
}
                  
            

QUERY PARAMETERS

Field Type Required Description
barcode String Yes The barcode associated to the label you want to track
lang String No Errors responses and shipment statuses language. Default is english. Available: en, it


RESPONSE PARAMETERS

Field Response Description
response 200 if success, 400 if error
code 200 Status code. Check Tracking Statuses for more details.
status 200 Status description. Language used is based on lang parameter. Default: en
date 200 Datetime in format yyyy-mm-dd hh:mm:ss. CEST Timezone.
locationPoint 200 Name of the Point, if the parcel is in stock or available in a Point. Default: null
locationAddress 200 Address of the Point, if the parcel is in stock or available in a Point. Default: null
locationCity 200 City of the Point, if the parcel is in stock or available in a Point. Default: null
locationZip 200 Zipcode of the Point, if the parcel is in stock or available in a Point. Default: null
error 400 Error code. Check Errors for more details.
message 400 Error description. Language used is based on lang parameter. Default: en

Get Points

                
#PHP-CURL full parameters example
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.alfred24.it/p2p/api/sandbox/getPoints',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => array(
        'user' => 'your_alfred24_username',
        'api_token' => 'your_alfred24_apitoken',
        'country' => 'IT',
        'address' => '41.89044855096006,12.491060229550026',
        'services' => '{"p2p":1}',
        'distance' => '7',
        'lang' => 'en',
        'lat' => '41.89044855096006',
        'lng' => '12.491060229550026',
        'external_source' => 1
    ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
                
            

To get the list of available points for the Alfred24 Delivery service, you need to make a POST request to: getPoints.


Success response:
                
{
    "response": 200,
    "count": 1,
    "items": [
        {
            "idPoint": "1234",
            "pointName": "(Point Partner) DITTA INDIVIDUALE",
            "pointLabel": "ditta individuale",
            "pointNetwork": "Point Partner",
            "pointRole": 16,
            "pointAddress": "Via Celimontana, 5",
            "pointCity": "Roma",
            "pointProvince": "RM",
            "pointZip": "00184",
            "email": "pointpartner@alfred24.it",
            "phone": "123456789",
            "latitude": "41.8892095",
            "longitude": "12.496593",
            "distance": 0.4638864238842373,
            "logo": "https://app.alfred24.it/alfred2/user/assets/img/avatars/profiles/avatar.png"
        }
    ]
}

                
Error response:              
                
{
    "response": 400,
    "error": "error_code",
    "message": "error_description"
}
                  
            

QUERY PARAMETERS

Field Type Required Description
user String Yes Your Alfred24 account login (email)
api_token String Yes Your Alfred24 API Token.
country String Yes The country short name in English as in ISO 3166. Allowed countries: IT
address String Yes The address to use to search Points around. It can be in the address format or coordinates format (latitute and longitude separated by comma).
services String Yes Filter Points by service. It has to be in JSON format.
distance Float Yes Distance radius from address, in Km.
lat Float No Latitude to use to search Points around. Mandatory if used external_source parameter
lng Float No Longitude to use to search Points around. Mandatory if used external_source parameter
external_source boolean No If used, lat and lng parameters will be used, instead of address parameter (which remains mandatory). This can speed-up the request
lang String No Errors responses language. Default is english. Available: en, it


RESPONSE PARAMETERS

Field Response Description
response 200 if success, 400 if error
count 200 number of Points found
items 200 Points list container
idPoint 200 Point ID.
pointName 200 Point business name
pointLabel 200 Point signboard on the street
pointNetwork 200 Point network
pointRole 200 Internal Alfred24 parameter
pointAddress 200 Complete Point address
pointCity 200 Point city
pointProvince 200 Point province
pointZip 200 Point zip code
email 200 Point email
phone 200 Point phone number
latitute 200 Point coordinate: latitude
longitude 200 Point coordinate. longitude
distance 200 Point distance from the searched address
logo 200 Point profile logo
error 400 Error code. Check Errors for more details.
message 400 Error description. Language used is based on lang parameter. Default: en

Points Services

The getPoints can have the optional services parameter in input, having:

Service Code Description
p2p Alfred24 Delivery service. Possible values: (integer) 1.

Tracking Statuses

The tracking uses the following status codes:

Status Code Description
P2P01 NEW. New label inserted in the system.
P2P02 CANCELLED. Label has been cancelled.
P2P03 IN STOCK AT THE POINT. Parcel has been taken by the reception Point, from the sender.
P2P04 IN TRANSIT. The parcel is in stock at one of our warehouses.
P2P05 PICKED UP FROM THE POINT. Parcel has been taken by the driver, from the reception Point.
P2P06 DELIVERING. Parcel has been taken by the driver, from the warehouse, heading to the delivery Point.
P2P07 AVAILABLE AT THE POINT. Parcel has been taken by the delivery Point, from the driver. It's ready to be delivered to the parcel's recipient.
P2P08 SENDER POINT CHANGED. If the sender point is closed or unavailable, this status is triggered. locationPoint, locationAddress, locationCity, locationZip parameters indicate the old point. This status is followed by the P2P03 status, containing the new Point holding the parcel.
P2P09 DELIVERY POINT CHANGED. If the delivery point is closed or unavailable, this status is triggered. locationPoint, locationAddress, locationCity, locationZip parameters indicate the old point. This status is followed by the P2P07 status, containing the new Point holding the parcel.
P2POK DELIVERED. Parcel has been delivered to the parcel's recipient.

Errors

Alfred24 APIs use the following error codes:

Error Code Meaning
AUTH01 Unauthorized, unknown or unvalid user token. This error appears if you use an unknow user token or if the user token expired or there aren't any token passed into the request.
AUTH02 APIs not enabled. This error appears if you pass a token or a user which hasn't APIs enabled.
RESOURCE01 Can't delete this resource. This error appears if you try to delete a resource which cannot be deleted.
SHIP01 Shipment not found. This error appears if try to retrieve a shipment which does not exist.
SHIP02 Can't delete this shipment because it's not active or has been already processed. This error appears if try to delete a shipment which cannot be deleted because it has already been processed or not active.
POINT01 Point not found. This error appears if you try to retrieve a point which does not exist or cannot be retrieved.
POINT02 Point not available. This error appears if you try to retrieve a point which is not available or active.
ADDRESS01 Address field required. This error appears if you try to perform a request and address is not included into the request.
ADDRESS02 Address field format string. This error appears if you try to pass an invalid format as address into the request.
DISTANCE01 Distance field required. This error appears if you try to perform a request and distance is not included into the request.
DISTANCE02 Distance field format integer. This error appears if you try to pass an invalid format as distance into the request.
DEVPOINT01 Delivery point field required. This error appears if you try to perform a request and deliveryPoint is not included into the request.
DEVPOINT02 Delivery point field format integer. This error appears if you try to pass an invalid format as deliveryPoint into the request.
SENDNAME01 Sender name field required. This error appears if you try to perform a request and senderName is not included into the request.
SENDNAME02 Sender name field format string. This error appears if you try to pass an invalid format as senderName into the request.
RECNAME01 Recipient name field required. This error appears if you try to perform a request and recipientName is not included into the request.
RECNAME02 Recipient name field format string. This error appears if you try to pass an invalid format as recipientName into the request.
PARCELWE01 Parcel's weight field required. This error appears if you try to perform a request and parcelWeight is not included into the request.
PARCELWE02 Parcel's weight field format integer. This error appears if you try to pass an invalid format as parcelWeight into the request.
PARCELH01 Parcel's height field required. This error appears if you try to perform a request and parcelHeight is not included into the request.
PARCELH02 Parcel's height field format integer. This error appears if you try to pass an invalid format as parcelHeight into the request.
PARCELWI01 Parcel's width field required. This error appears if you try to perform a request and parcelWidth is not included into the request.
PARCELWI01 Parcel's width field format integer. This error appears if you try to pass an invalid format as parcelWidth into the request.
PARCELL01 Parcel's length field required. This error appears if you try to perform a request and parcelLength is not included into the request.
PARCELL02 Parcel's length field format integer. This error appears if you try to pass an invalid format as parcelLength into the request.
SENDADDRESS01 Sender address field required. This error appears if you try to perform a request and senderAddress is not included into the request.
SENDADDRESS02 Sender address field format string. This error appears if you try to pass an invalid format as senderAddress into the request.
SENDPHONE01 Sender phone field required. This error appears if you try to perform a request and senderPhone is not included into the request.
SENDPHONE02 Sender phone field format not allowed. This error appears if you try to pass an invalid format as senderPhone into the request.
SENDEMAIL01 Sender email field required. This error appears if you try to perform a request and senderEmail is not included into the request.
SENDEMAIL02 Sender email field format not allowed. This error appears if you try to pass an invalid format as senderEmail into the request.
SENDCITY01 Sender city field required. This error appears if you try to perform a request and senderCity is not included into the request.
SENDCITY02 Sender city field format not allowed. This error appears if you try to pass an invalid format as senderCity into the request.
SENDZIPCODE01 Sender zipcode field required. This error appears if you try to perform a request and senderZip is not included into the request.
SENDZIPCODE02 Sender zipcode field format string. This error appears if you try to pass an invalid format as senderZip into the request.
SENDZIPCODE03 Sender zipcode field format not allowed. This error appears if you try to pass an invalid format as senderZip into the request.
SENDZIPCODE04 Sender zipcode field min 5 chars. This error appears if you try to pass a value less than 5 chars as senderZip into the request.
SENDZIPCODE05 Sender zipcode field max 5 chars. This error appears if you try to pass a value greater than 5 chars as senderZip into the request.
RECADDRESS01 Recipient address field required. This error appears if you try to perform a request and recipientAddress is not included into the request.
RECADDRESS02 Recipient address field format string. This error appears if you try to pass an invalid format as recipientAddress into the request.
RECPHONE01 Recipient phone field required. This error appears if you try to perform a request and recipientPhone is not included into the request.
RECPHONE02 Recipient phone field format not allowed. This error appears if you try to pass an invalid format as recipientPhone into the request.
RECEMAIL01 Recipient email field required. This error appears if you try to perform a request and recipientEmail is not included into the request.
RECEMAIL02 Recipient email field format not allowed. This error appears if you try to pass an invalid format as recipientEmail into the request.
RECCITY01 Recipient city field required. This error appears if you try to perform a request and recipientCity is not included into the request.
RECCITY02 Recipient city field format not allowed. This error appears if you try to pass an invalid format as recipientCity into the request.
RECZIPCODE01 Recipient zipcode field required. This error appears if you try to perform a request and recipientZip is not included into the request.
RECDZIPCODE02 Recipient zipcode field format string. This error appears if you try to pass an invalid format as recipientZip into the request.
RECZIPCODE03 Recipient zipcode field format not allowed. This error appears if you try to pass an invalid format as recipientZip into the request.
RECZIPCODE04 Recipient zipcode field min 5 chars. This error appears if you try to pass a value less than 5 chars as recipientZip into the request.
RECZIPCODE05 Recipient zipcode field max 5 chars. This error appears if you try to pass a value greater than 5 chars as recipientZip into the request.
LAT01 Latitude field required. This error appears if you try to perform a request and lat is not included into the request.
LNG01 Longitude field required. This error appears if you try to perform a request and lng is not included into the request.
EXTSOURCE01 External source field format bool. This error appears if you try to pass an invalid format as external_source into the request.
PRINTFORMAT02 Print format field format not allowed. This error appears if you try to pass an invalid format as printFormat into the request.
LBLDIGITAL02 Label digital field format not allowed. This error appears if you try to pass an invalid format as digital into the request.
URL02 Url field format not allowed. This error appears if you try to pass an invalid format as customLogo into the request.
NOTE02 Note field format string. This error appears if you try to pass an invalid format as note into the request.
PSIZE01 Parcel's sizes not allowed. This error appears if you try to pass parcel's sizes not allowed into the request.
SERVICES01 Services field format json. This error appears if you try to pass an invalid format as services into the request.
SERVICES02 Services: each value's key need to be 0 or 1. This error appears if you try to pass at least an invalid value to one key in services into the request.
COUNTRY01 Country field required. This error appears if you try to perform a request and country is not included into the request.
COUNTRY02 Country not allowed. This error appears if you try to pass an invalid value for country into the request.