# API Basics source: https://developer.mastercard.com/issuer-enrollment/documentation/api-basics/index.md ## Client Authentication {#client-authentication} Most Mastercard APIs use OAuth 1.0a request signing with an API Signing Key and Consumer Key. Authentication requirements vary by API, so check each operation's security definition in the [API Reference](https://developer.mastercard.com/issuer-enrollment/documentation/api-reference/apis/index.md). Learn more about these keys in the [Key Management](https://developer.mastercard.com/issuer-enrollment/documentation/tutorials-and-guides/key-management-click2pay-tutorial/index.md) tutorial. | Authentication Protocol | Details | |--------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [OAuth 1.0a](https://oauth.net/core/1.0a/) | Mastercard uses OAuth 1.0a with a body hash extension for authenticating the API clients. OAuth 1.0a is an authentication and authorization protocol that guarantees the integrity and authenticity of incoming API calls and allows for non-repudiation of requests. | OAuth requires every request that you send to Mastercard to be signed with an RSA private key. A private-public RSA key pair must be generated consisting of: 1. A **private key** for signing OAuth API requests. Store the private key in a password-protected or hardware keystore. It encrypts the signature base string hash, which the server decrypts using the public key. 2. A **public key** shared with Mastercard during project setup through a certificate signing request (CSR) or an API Key Generator. Mastercard uses the public key to verify the OAuth signature on every API call. * Requests with a body must be signed using the [Google Request Body Hash](https://tools.ietf.org/id/draft-eaton-oauth-bodyhash-00.html) extension for OAuth. * The OAuth keys are created during the process of project creation on Mastercard Developers. Additionally, you can add new OAuth keys inside your project dashboard if needed. The client signs each request with the private API Signing Key, and the Consumer Key identifies the client. Some APIs may require an additional or different authentication scheme; follow the operation's security definition. Authentication requirements can vary by API, so follow the operation's security definition and the [Using OAuth 1.0a to Access Mastercard APIs](https://developer.mastercard.com/platform/documentation/authentication/using-oauth-1a-to-access-mastercard-apis/) guide. You can find client authentication libraries on [GitHub](https://github.com/Mastercard?&q=oauth), with how-to information provided in README.md files. Note: For push provisioning with the MDES Token Connect APIs, see the [MDES Token Connect API Basics](https://developer.mastercard.com/mdes-token-connect/documentation/api-basics/) guide. ## Transport Encryption {#transport-encryption} * The transport between client applications and Mastercard is secured using [TLS/SSL](https://en.wikipedia.org/wiki/Transport_Layer_Security), which means data is encrypted by default when transmitted across networks. * Some operations require sensitive request fields to be submitted as JWE-encrypted payloads; some responses also contain encrypted fields. Check the operation's request and response schemas in the [API Reference](https://developer.mastercard.com/issuer-enrollment/documentation/api-reference/apis/index.md) to determine whether payload encryption applies and which fields are encrypted. Follow the [Perform Encryption tutorial](https://developer.mastercard.com/issuer-enrollment/documentation/tutorials-and-guides/perform-encryption-tutorial/index.md) when required. * To learn more about Encryption Keys used to encrypt an object, refer to the [Key Management](https://developer.mastercard.com/issuer-enrollment/documentation/tutorials-and-guides/key-management-click2pay-tutorial/index.md) and [Perform Encryption](https://developer.mastercard.com/issuer-enrollment/documentation/tutorials-and-guides/perform-encryption-tutorial/index.md) tutorials. Note: Visit [Securing Sensitive Data Using Payload Encryption](https://developer.mastercard.com/platform/documentation/security-and-authentication/securing-sensitive-data-using-payload-encryption/) to learn more about our encryption methods. ### JWE {#jwe} | Authentication Protocol | Details | |----------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [JSON Web Encryption](https://datatracker.ietf.org/doc/html/rfc7516) | JSON Web Encryption (JWE) represents encrypted content using JSON-based data structures [RFC7159](https://datatracker.ietf.org/doc/html/rfc7159) and base64url encoding. Mastercard uses [JWE compact serialization](https://datatracker.ietf.org/doc/html/rfc7516#section-7.1) for the encryption of sensitive data and supports full body payload encryption. | ## Environment Descriptions {#environment-descriptions} The following table describes the standard environments and API hosts. | Environment | Base URL | Description | |-------------|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Sandbox | `https://sandbox.api.mastercard.com` | The sandbox environment is an open, self-service test environment where developers can experiment with API calls without affecting real data or systems, ensuring that any errors or issues can be safely identified and resolved. Fully test your integration in Sandbox before moving to Production. | | Production | `https://api.mastercard.com` | The production environment is the live environment where the API interacts with actual users and data. Request access after completing testing and receiving the required approvals. | The API path and, in some cases, the hostname vary by API and region. Use the full server URL listed in the relevant [API reference](https://developer.mastercard.com/issuer-enrollment/documentation/api-reference/apis/index.md). API errors can occur when the gateway rejects an incorrect or malformed request, or when the service rejects a request based on business logic. Refer to the [Code and Formats](https://developer.mastercard.com/issuer-enrollment/documentation/code-and-formats/index.md) page for details. ## How to Consume the API? {#how-to-consume-the-api} ### Generating an OpenAPI Client {#generating-an-openapi-client} Use the [OpenAPI Generator](https://openapi-generator.tech/) to generate client code from the relevant API specification, or choose a Mastercard open-source client library. Follow the [Mastercard API client setup guidance](https://developer.mastercard.com/platform/documentation/security-and-authentication/generating-and-configuring-a-mastercard-api-client/) to configure authentication and perform any encryption or decryption required by the API. ### Next Steps {#next-steps} Now that you have an understanding of the service's authentication and encryption, proceed to the [Use Cases](https://developer.mastercard.com/issuer-enrollment/documentation/use-cases/index.md) section to learn how to create and manage digital payment credentials within Mastercard Credential Services.