Universal Print (UP) Printer Registration
1. Registration
1.1 Flow
1.2 APIs
The following APIs are available with the Global UP Registration Service for registering printers.
Global UP Registration Service Base URL: https://register.print.microsoft.com
The full URL will be the combination of the Global base URL and the endpoint(s) below.
1.2.1 /register
The /register endpoint is used to register a printer. There are 2 stages for registration.
Initial registration call to register the printer
Polling registration status for completion of the registration request
1.2.1.1 Initiating Registration
The first stage is to initiate a registration request with the global registration service. This is done by issuing a POST request to the /register endpoint with the registration payload in JSON format.
1.2.1.1.1 HTTP Request
POST /api/{version}/register
{version}
is the version of the UP Registration API/protocol that the printer is using.
Currently supported versions are:
- v1.0
1.2.1.1.2 Request Headers
For v1.0:
Name | Description |
---|---|
Authorization | Bearer {token} Required. The printer must sign-in the admin to Microsoft Entra ID, by follow the Device Code flow or another authorization flow. |
1.2.1.1.3 Request Content-Type
application/json
1.2.1.1.4 Request Payload
The registration request payload will be in JSON format with the following values (case sensitive):
Value name | Value type | Description | Required |
---|---|---|---|
name | string | The friendly name of the Printer. | Yes |
manufacturer | string | The manufacturer of the Printer. | Yes |
model | string | The model of the Printer. | Yes |
device_id | string | The physical device UUID of the Printer. | Yes |
device_type | string | The type of the device. Supported values (without quotes): "printer" | Yes |
certificate_request | DeviceCertRequest object | The X.509 Certificate Signing Request (CSR) for the certificate created and used by the printer to identify itself. Please refer to Appendix A.1 for a coding sample on how to create a CSR with BouncyCastle .NET library. | Yes |
The DeviceCertRequest object has the following values (case sensitive):
Value name | Value type | Description | Required |
---|---|---|---|
type | string | A property that MUST contain "pkcs10". | Yes |
data | string | A property that contains a base64-encoded PKCS#10 certificate request RFC4211. The certificate request MUST use an RSA public key algorithm with a 2048-bit key, a SHA256WithRSAEncryption signature algorithm, and a SHA256 hash algorithm. | Yes |
transport_key | string | The base64-encoded public portion of an asymmetric key that is generated by the client. | Yes |
1.2.1.1.5 Successful Response
On success (202 Accepted), the registration response payload will be in JSON format with the following values (case sensitive):
Value name | Value type | Description | Required |
---|---|---|---|
registration_id | string | The unique ID that represents this registration request. This will be used when polling for registration status. | Yes |
interval | integer | Polling interval time (in seconds) to check for completion of the registration request. | Yes |
1.2.1.1.6 Error Response
On error, the following HTTP status codes will be returned along with an error response payload. The error response payload will contain an error JSON object following the format in section 2.
HTTP Status Codes
HTTP Status Code | Description |
---|---|
400 (Bad Request) | The request is invalid or malformed. See error response payload for details. Fix and resend the request. |
500 (Internal Server Error) | An internal error has occurred in the service. See error response payload for details. Retry the request (if possible, retry_timeout will be set). |
Error Codes
Error Codes | Description | HTTP Status Code |
---|---|---|
invalid_request | The registration request payload was malformed/invalid. This usually occurs during development stages. See error_description for more details. | 400 |
device_code_error | The service could not generate a Device/User Code pair. | 500 |
storage_error | The service experienced an error with Back-end Storage. | 500 |
service_error | An error occurred in the service. See error_description for more details. | 500 |
1.2.1.1.7 Examples
1.2.1.1.7.5 Request v1.0
POST https://register.print.microsoft.com/api/v1.0/register HTTP/1.1
Connection: Keep-Alive
Content-Type: application/json; charset=utf-8
Accept-Encoding: gzip, deflate
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkZ6U3pHTVZ1a0U2Nm9EQnpwR0JUY2NBMlVRYyIsImtpZCI6IkZ6U3pHTVZ1a0U2Nm9EQnpwR0JUY2NBMlVRYyJ9.eyJhdWQiOiJodHRwczovL3ByaW50LnByaW50LXBwZS5taWNyb3NvZnQuY29tIiwiaXNzIjoiaHR0cHM6Ly9zdHMud2luZG93cy1wcGUubmV0LzIwZGY5NTlmLWE0OTItNGU3NC05N2E3LTE0YWJiM2ZlZjFkYi8iLCJpYXQiOjE1NjE2NzUxNjYsIm5iZiI6MTU2MTY3NTE2NiwiZXhwIjoxNTYxNjc5MDY2LCJhY3IiOiIxIiwiYWlvIjoiNDJOZ1lOQXNYbUtTSHZSM3Jvcjd2RVdMMWtmc0NMUi93R085cjYzMGl2T1RLWlVoV1ZzQSIsImFtciI6WyJwd2QiXSwiYXBwaWQiOiI0MTdhZTZlYi1hYWM4LTQ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ZcNtrNKt3YpHFzG4kgy5V6wGLecRI7IBzYd4uK_FwpaYXHpkrSbO0ATEX3tjrgPnHbicA053Ilw
Content-Length: 1600
{
"name": "Test Printer",
"manufacturer": "Test Manufacturer",
"model": "Test Model",
"device_type": "printer",
"device_id": "a188d9e8-8daa-44c9-862b-d6202bcf1b68",
"certificate_request":
{
"type": "pkcs10",
"data": "MIICpDCCAYwCAQAwYTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1JlZG1vbmQxFzAVBgNVBAoMDk1pY3Jvc29mdCBDb3JwMRIwEAYDVQQDDAlNaWNyb3NvZnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDJ1xUdFKBlFdS9dHqSrD7YS0ZJ6MgcYy5wI3P0wOWrDi28OCBLbt6HBg02KDh1MlmVrfIR2O6WWeJ59M63JuwEn2e2WoGnIb/M6NyANyBBmgZ3bjp39UJHbXtYYXm/VJrPcOLM09dST7KR1zAcD2J+rnK8ZVUtYuTl58D7R6zsrYshw5CwxfLYPXeXwiSoKhtEC8Xn1lz3mi5B2SdsFHdjaQb6E0tCG5zdrVzzhCEVPaoo4e9SCTB9jDNulTU1ZkHzGBk+UzlKv4APsclyGCTEgA01T6/ueBrVeKY9d4DYfz/pu4sm0Vf1E+2hggtwbBOP60sFtkfnKiwtVoDF1KC9AgMBAAEwDQYJKoZIhvcNAQELBQADggEBACdggPBJ5MoJJ3QjVYDypuJGWDVWBT0G4pXNZHNz5Q4OVDze7aCw3Sl78Qdzy++XsrSXjtyZyEb+A5R36YKTpzRBCHSOWyZkZKpxj0Uo8/+RzjzJ1uvtwfhelfQ6EVktFsz6a2hixcaa47bN/bjj9stJbbRsxjJwR1K5YI/i+9DaUE7r7VDXiknQ7/ZyEYquAqY/O/LEnFOGhkSvkLlFPTbnJ7fzURyNnQhmp8p3DMj5dXYgKfWPxViqvJChx8pJf9zM4TjzaTZIj08tSOp2LtWGeMNkFgYJH4URe3t4OPx5crkKj8i5aIW1Ulb8ezJLW1IU7W8hF71ooZWFTOsAnjQ=",
"transport_key":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAydcVHRSgZRXUvXR6kqw+2EtGSejIHGMucCNz9MDlqw4tvDggS27ehwYNNig4dTJZla3yEdjullniefTOtybsBJ9ntlqBpyG/zOjcgDcgQZoGd246d/VCR217WGF5v1Saz3DizNPXUk+ykdcwHA9ifq5yvGVVLWLk5efA+0es7K2LIcOQsMXy2D13l8IkqCobRAvF59Zc95ouQdknbBR3Y2kG+hNLQhuc3a1c84QhFT2qKOHvUgkwfYwzbpU1NWZB8xgZPlM5Sr+AD7HJchgkxIANNU+v7nga1XimPXeA2H8/6buLJtFX9RPtoYILcGwTj+tLBbZH5yosLVaAxdSgvQIDAQAB"
}
}
1.2.1.1.7.6 Response v1.0
HTTP/1.1 202 Accepted
Date: Thu, 27 Jun 2019 22:47:34 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
{
"registration_id": "fbbd6371-7e88-4881-8818-8d2ea2e8fe88",
"interval": 5
}
1.2.1.2 Getting Registration Status
After the registration request has been successfully accepted, the printer will poll the /register
endpoint for the status of the registration request. The printer should poll based on the interval value received in the registration response and must provide the registration_id
received.
1.2.1.2.1 HTTP Request
GET /api/{version}/register?{Query Parameters}
{version}
is the version of the UP Registration API/protocol that the printer is using.
Currently supported versions are:
- v1.0
{Query Parameters}
are specified in the next section.
1.2.1.2.2 Request Headers
For v1.0:
Name | Description |
---|---|
Authorization | Bearer {token} Required. The printer must sign-in the admin to Microsoft Entra ID, or follow the Device Code flow. Same token acquired for first register request can be used. |
1.2.1.2.3 Request Query Parameters
Parameter name | Description | Required |
---|---|---|
registration_id | The registration ID received from the response of the registration request. | Yes |
1.2.1.2.4 Successful Responses
The following HTTP status codes will be returned for the following "success" scenarios:
HTTP Status Code | Registration Phase |
---|---|
200 (OK) | Registration Complete |
202 (Accepted) | Registration In Progress - Please make another request after the interval time has passed |
Response Payloads
Registration In Progress (202 Accepted):
The registration response payload will be in JSON format with the following values (case sensitive):
Value name | Value type | Description | Required |
---|---|---|---|
interval | integer | Polling interval time (in seconds) to check for completion of the registration request. Note, the polling interval time will not necessary be the same each time. | Yes |
Registration Complete (200 OK):
The registration response payload will be in JSON format with the following values (case sensitive):
Value name | Value type | Description | Required |
---|---|---|---|
cloud_device_id | string | The UUID of the printer in the Cloud that this printer represents. | Yes |
certificate | string | Base64-encoded Signed X.509 Certificate. | Yes |
print_svc_url | string | The URL to the Universal Print (UP) service that handles printer operations. | Yes |
notification_url | string | The URL that should be used by the printer to listen for notifications (new print job, cancel print job, etc...). | Yes |
mcp_svc_resource_id | string | The Resource ID of the UP service. Required when requesting OAuth token for communication with the UP and UP Notification Services. | Yes |
device_token_url | string | The URL of the Secure Token Authority (STA) that the printer should use to get tokens for the UP and UP Notification Services. | Yes |
1.2.1.2.5 Error Response
On error, the following HTTP status codes will be returned along with an error response payload. The error response payload will contain an error JSON object following the format in section 2.
HTTP Status Codes
HTTP Status Code | Description |
---|---|
400 (Bad Request) | The request is invalid or malformed. See error response payload for details. Registration should be re-started. |
500 (Internal Server Error) | An internal error has occurred in the service. See error response payload for details. Registration should be re-started. |
Error Codes
Error Codes | Description | HTTP Status Code |
---|---|---|
invalid_registration_id | The registration ID provided is invalid. This can occur if the registration ID was stored incorrectly or if the printer registration has not completed within the registration timeout. Registration should be re-started. | 400 |
device_already_exists | The device that is being registered is already registered. The Admin should check the UP portal to see if the device being registered is present. If it is, it could be a stale entry that the Admin forgot to delete/un-register. Registration should be re-started. | 400 |
user_token_error | The service failed to get the user token to perform registration. Registration should be re-started. | 500 |
storage_error | The service experienced an error with Back-end Storage. Registration should be re-started. | 500 |
service_error | An error occurred in the service. See error_description for more details. Registration should be re-started. | 500 |
1.2.1.2.6 Examples
1.2.1.2.6.3 Request v1.0
GET https://register.print.microsoft.com/api/v1.0/register?registration_id=bb86db79-2918-
Authorization: Bearer eyJ0eXAi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5pcXVlX25hbWUiOiJtYXN0YWdlckBjbG91ZHByaW50cHBlLmNjc2N0cC5uZXQiLCJ1cG4iOiJtYXN0YWdlckBjbG91ZHByaW50cHBlLmNjc2N0cC5uZXQiLCJ1dGkiOiJlal84QlAtLW1rZWNNWjdncFJNR0FBIiwidmVyIjoiMS4wIiwid2lkcyI6WyI2MmU5MDM5NC02OWY1LTQyMzctOTE5MC0wMTIxNzcxNDVlMTAiXX0.e1RpyZDQzqlV11uyRXWRmaqf6wk2mg763muoIiMG2Qq8DW221Rg91cLP5px6KSfhpd7nv-Ln_KUFsZ4IlJqfmsrfCL_vgKHjYQuRDv2BY8-vrIqUC_5XVA_sj2Ib7iT7SjDYyMv6QDZM2rf7kVggvRuaZihUxxGZWby84EXD8KKAYfAQGo3r6AceuSDJOvToMy-Kp-MEqRuzExZdq2p1_qRIBtHe8Its4xuR8ZHEVqWnY0Y_qeVA8uxl3mQxZSvH8BVYn4Bdy_VZcNtrNKt3YpHFzG4kgy5V6wGLecRI7IBzYd4uK_FwpaYXHpkrSbO0ATEX3tjrgPnHbicA053Ilw
Host: register.print.microsoft.com
1.2.1.2.6.4 In Progress Response v1.0
HTTP/1.1 202 Accepted
Cache-Control: no-cache
Pragma: no-cache
{
"interval": 15
}
1.2.1.2.6.7 Completed Response v1.0
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 267
Content-Type: application/json; charset=utf-8
{
"cloud_device_id": "7c907b43-d8f0-4e42-a279-1e37eb4fd2bf",
"certificate": "MIID8jCCAtqgAwIBAgIQR2Y15zkurJhCGxcaQ0d7tjANBgkqhkiG9w0BAQsFADB4MXYwEQYKCZImiZPyLGQBGRYDbmV0MBUGCgmSJomT8ixkARkWB3dpbmRvd3MwHQYDVQQDExZNUy1Pcmdhbml6YXRpb24tQWNjZXNzMCsGA1UECxMkODJkYmFjYTQtM2U4MS00NmNhLTljNzMtMDk1MGMxZWFjYTk3MB4XDTE4MDExOTAwNTIxM1oXDTI4MD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P0GA0gY/Ohv5ssgrCFsiBq",
"print_svc_url": "https://print.print.microsoft.com/",
"notification_url": "https://notification.print.microsoft.com/",
"mcp_svc_resource_id":"https://print.print.microsoft.com",
"device_token_url": "https://login.microsoftonline.com/common/oauth2/token"
}
1.2.1.3 Authentication
Before registering the printer must authenticate the admin to Microsoft Entra ID, by follow the Device Code flow or another authorization flow. The printer admin access token obtained must be sent in the authorization header of the request to register a printer. Documentation of device code and other authentication flows supported by Microsoft Entra ID can be found at Supported authentication flows.
1.2.1.3.1 Device Code Flow Parameters
Documentation of Microsoft Entra ID support of the device code flow can be found at OAuth 2.0 device code flow. The client_id
listed below is temporary. We will provide additional information in the near future.
Parameter Name | Description | Required |
---|---|---|
tenant | Use "Organizations" for the tenant parameter. | Yes |
client_id | Use registered client ID for the client_id. Additional information at Registering OEM Client. |
Yes |
scope | Use https://print.print.microsoft.com/.default for the scope |
Yes |
1.2.1.3.2 Example Device Code Flow Requests
1.2.1.3.2.1 Initiate the device code flow
Request:
POST https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode HTTP/1.1
Accept-Charset: utf-8
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host: login.microsoftonline.com
Content-Length: 103
Expect: 100-continue
Connection: Keep-Alive
client_id=<registered_client_id>&scope=https%3A%2F%2Fprint.print.microsoft.com%2F.default
Response:
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Content-Length: 473
{
"user_code": "FMTB7B3WR",
"device_code": "FAQABAAEAAAAP0wLlqdLVToOpA4kwzSnx3SB1wjNptiBt5jFM8ePgJKGOjX-WOEksHYT3zgqz9VVg4MqY8J6Tej_rpniyj4WjOsVe-RCJuGexX-IwPKDK-df38P0zpLv5ktxSCflT_F-8Cbef6BRDpk0Qm-lPOhC4bcbtdIaM8yqf-cS962rGC9VdVNFVFStePppCDRcumjAgAA",
"verification_uri": "https://microsoft.com/devicelogin",
"expires_in": 900,
"interval": 5,
"message": "To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code FMTB7B3WR to authenticate."
}
1.2.1.3.2.2 Retrieving the user token
Request:
POST https://login.microsoftonline.com/tenant/oauth2/v2.0/token HTTP/1.1
Accept-Charset: utf-8
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host: login.microsoftonline.com
Content-Length: 289
Expect: 100-continue
grant_type=device_code&client_id=<registered_client_id>&device_code=FAQABAAEAAAAP0wLlqdLVToOpA4kwzSnx3SB1wjNptiBt5jFM8ePgJKGOjX-WOEksHYT3zgqz9VVg4MqY8J6Tej_rpniyj4WjOsVe-RCJuGexX-IwPKDK-df38P0zpLv5ktxSCflT_F-8Cbef6BRDpk0Qm-lPOhC4bcbtdIaM8yqf-cS962rGC9VdVNFVFStePppCDRcumjAgAA
Response: authorization_pending
, user has not logged in yet.
HTTP/1.1 400 Bad Request
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Content-Length: 469
{
"error": "authorization_pending",
"error_description": "AADSTS70016: Pending end-user authorization.\r\nTrace ID: 60997c8b-15ed-4d12-99b6-6da879fd1400\r\nCorrelation ID: 7300aba9-1698-4a4e-b6dd-66459a828108\r\nTimestamp: 2019-09-26 23:13:43Z",
"error_codes": [70016],
"timestamp": "2019-09-26 23:13:43Z",
"trace_id": "60997c8b-15ed-4d12-99b6-6da879fd1400",
"correlation_id": "7300aba9-1698-4a4e-b6dd-66459a828108",
"error_uri": https://login.microsoftonline.com/error?code=70016
}
Response: success
, user has logged in, token is returned. This token can be used in the required authorization header (described in section 1.2.1.1.2) when sending a request to register a printer with Universal Print.
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Content-Length: 1763
{
"token_type": "Bearer",
"scope": "https://print.print.microsoft.com/Print.Device https://print.print.microsoft.com/.default",
"expires_in": 3599,
"ext_expires_in": 3599,
"access_token": "eyJ0eXAiOiJKV1QiLCJ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GNsb3VkcHJpbnRwcm9kdWN0aW9uLm9ubWljcm9zb2Z0LmNvbSIsInV0aSI6Inp2N2EtdGRrR0VHQkFSMl9zWU1UQUEiLCJ2ZXIiOiIxLjAiLCJ3aWRzIjpbIjYyZTkwMzk0LTY5ZjUtNDIzNy05MTkwLTAxMjE3NzE0NWUxMCJdfQ.Nfz82GPdQUx6py2xwhVhI4hvpbLTdaaDSVFnGx4Eb3CeJHcQvCmmKoB9Lze7YITcEcLdxUkGEQGEXSh6M3yDrNP_hsoIROdWhe6RDjbYVPmJUL319lL4eNtQTJq8bKcJVbeM5SamlY1mBIhxH_sjL4TX0NN2RnDIuF_L1NSRW0IaHoZxzf257y0n7BqPROl3VpQ97wA8P-hhVBbfwwB9i-sLbsoCVszuE9JnHpgJPm6h9FDL9Px57ddTMZDvJchxOL5gUTA76gdRqUUzLROCMlz0R7vTJotl2RQnrzZBoNNoM9iJHL2KqQKuuezHEro1453lSRASiBkZHHEOFglzSg"
}
2. Error Response Structure
For the above APIs, on error, the following error structure will be returned in the payload in JSON format with the following values (case sensitive). These error responses are mainly for development purposes and it is up to the developer what to show to the user, if anything.
Value name | Value type | Description | Required |
---|---|---|---|
error | string | An error code string that is used to classify the type of error that occurred. | Yes |
error_description | string | A specific error message that can help identity the root cause of the error. | No |
error_code | integer | Additional error code that can help diagnose the issue. | No |
http_status_code | integer | The HTTP status code that was returned with this error response. | No |
retry_timeout | integer | The number of seconds that the printer should wait before retrying the request. | No |
Each API above will list out its possible error code string(s).
2.1 Example Response
{
"error": "invalid_request",
"error_description": "Missing required field device_type"
}
Connectivity with Universal Print service after printer registration
Universal Print supports the required functionality defined in PWG 5100.18 (IPP Infra). Universal Print ready printers are expected to use this protocol to communicate with Universal Print once it has completed the printer registration process. To ensure the caller is a printer with access, the printer will use the device Access Token, as described in Printer Access Token Retrieval, as the Bearer value for the HTTP Authorization
header.