The first connection is usually the boundary for all ASME codes.
The first welded connection off the boiler, be it welded, threaded, or flanged. Likewise with unfired pressure vessels, the first connection of the vessels, be it welded, threaded, or flanged. The same holds true for connecting piping, it begins with the first connection off the vessel. This information is typically listed in the "Scope" of the construction code, i.e., Section I, Section VIII, B31.1, etc., you are working with. A schematic is typically included delineating the boundary.
Best regards - Al