“The Abc Music Standard 2.1: §3.1.1: X:—Reference Number”, Chris Walshaw2011-12 ()⁠:

The X: (reference number) field is used to assign to each tune within a tunebook an unique reference number (a positive integer), for example: X:23.

The X: field is also used to indicate the start of the tune (and hence the tune header), so all tunes must start with an X: field and only one X: field is allowed per tune.

The X: field may be empty, although this is not recommended.

Recommendation for developers: Software which writes abc files is recommended to offer users the possibility to manage X: field numbering automatically. GUI applications may even hide the X: field from users although they should always allow the user access to the raw abc file.