Methods

The complete information that you can obtain with the Metadata APi is the following.

http://169.254.169.254

2017-04-23/ All methods available in this first version of the API released on Apr 23rd 2017. When new methods are added/changed, new dates will appear.
latest/ All current methods available in the API.
meta_data/ All metadata information about the server you queried.
user_data Information set by the user when created the server. More information here.
vendor_data Internal information about the configuration of the Cloud Config modules.

http://169.254.169.254/latest/meta_data

server_id Id of the server where this request is executed. The id matches with the internal server’s id for the public Cloud Server API.
hostname Initial hostname of the server.
public_hostname Public hostname of the server. Not available for all servers. Empty in that case.
datacenter The datacenter where the server is located.
interfaces/ Information regarding the public and private interfaces.
dns/ intormation about the DNS configured for the server.

http://169.254.169.254/latest/meta_data/interfaces/

public/ Lists the public interfaces assigned to the server. Usually only one.
private/ Lists the private interfaces assigned to the server.

http://169.254.169.254/latest/meta_data/interfaces/public/

0/ Shows information about the first public interface.

http://169.254.169.254/latest/meta_data/interfaces/public/0/

mac MAC of the interface.
ipv4/ Lists the IPv4 IP assigned to the server.

http://169.254.169.254/latest/meta_data/interfaces/public/0/ipv4/

0/ First IP assigned to the server.

http://169.254.169.254/latest/meta_data/interfaces/public/0/ipv4/0/

ip_address IP address.
netmask/ Netmask configured for the IP.
gateway/ Gateway configured for the IP.

http://169.254.169.254/latest/meta_data/dns/

nameservers List of the nameservers configured for the server.

UserData

http://169.254.169.254/latest/meta_data/interfaces/

When a new server is created from the CloudPanel, there is a special field in Advanced Options called UserData. Any text entered here will be saved as the UserData for the server. It will be accessible from the Metadata API.

The real use of the UserData, however, is the connection that it has with Cloud Init. Cloud Init is a special package preinstalled on certain Operating Systems (CentOS, Ubuntu, Debian, Windows) that allows scripts added to the UserData field to be executed on the server when called.

CloudInit has its own meta-language called CloudConfig. You can browse various examples on its website.

There are additional programming languages allowed as bash, such as bash, Powershell or Command-Line. These scripts can take advantage of the Metadata API because they will be executed after the server is deployed. So, it's possible to declare a variable IP based on the content of a request, like the following:

curl http://169.254.169.254/latest/meta_data/interfaces/public/0/ipv4/0/ip_address

These scripts are useful to configure the server as desired after its creation. It's possible to install packages, users, configure services, etc.