To onboard devices programmatically, use the nRF Cloud bulk onboarding endpoint. It accepts a CSV file with as few as one data row, which holds a deviceId and an attestationToken column, and it is authenticated with an organization auth token. For the CSV format, the endpoint, and the required credentials, see Onboarding devices in bulk.