Authentication overview
Yes No secures access to its API through API key authentication. This method ensures that all requests made to the Yes No platform, whether for generating synthetic data, masking sensitive information, or managing test environments, originate from an authorized source. API keys function as bearer tokens, which are secrets passed with each API request to verify the client's identity and permissions.
The Yes No API is designed for programmatic interaction, supporting various operations related to test data management. Authentication is a prerequisite for all API calls, safeguarding the integrity and confidentiality of the data generation processes. Developers integrate these keys directly into their applications or use one of the supported SDKs, which abstract much of the authentication handling.
Adherence to secure handling practices for API keys is critical. Compromised API keys can lead to unauthorized access to your Yes No account's capabilities, potentially exposing proprietary data models or allowing misuse of service quotas. Yes No enforces HTTPS/TLS for all API communication, encrypting data in transit and protecting against eavesdropping and man-in-the-middle attacks, aligning with industry-standard network security best practices.
Supported authentication methods
Yes No primarily utilizes API key authentication. This method is straightforward for developers to implement and manage, offering a balance of security and usability for typical API integration scenarios:
| Method | When to use | Security Level |
|---|---|---|
| API Key (Bearer Token) | Programmatic access from servers, backend services, or trusted clients. Ideal for applications requiring direct API interaction for data generation, masking, and management. | High (when managed securely). Relies on the confidentiality of the key. Requires HTTPS for secure transmission. |
In this model, the API key acts as a secret token that grants access to the associated Yes No account's resources and permissions. It is essential to treat API keys with the same level of security as other sensitive credentials, such as passwords or private keys. The simplicity of API key authentication makes it suitable for a wide range of integration patterns, from automated CI/CD pipelines to custom data transformation scripts.
Getting your credentials
To obtain an API key for Yes No, you must first have an active account. New users can sign up for a Developer Plan, which includes a free tier, to get started. Once registered and logged in, API keys are generated and managed through the Yes No dashboard.
- Log in to your Yes No Account: Navigate to the Yes No login page and enter your credentials.
- Access API Settings: In the dashboard, locate the "API Keys" or "Settings" section. The exact navigation may vary but is typically found under your user profile or account management area. Refer to the Yes No authentication guide for precise steps.
- Generate a New API Key: You will typically find an option to "Generate New Key" or "Create API Key." Follow the prompts, which may include naming your key for easier identification (e.g., "Development Environment Key," "Production Service Key").
- Copy and Store Your Key: Once generated, the API key will be displayed. It is crucial to copy this key immediately and store it securely. For security reasons, Yes No generally only displays the full API key once upon creation and does not store it in a retrievable format. If you lose your key, you will need to generate a new one.
Yes No recommends creating separate API keys for different environments (e.g., development, staging, production) or distinct applications. This practice enhances security by allowing you to revoke a specific key if compromised without affecting other services. Each key can often be associated with specific permissions, although the core Yes No API keys typically grant broad access to your account's data generation capabilities.
Authenticated request example
Once you have your API key, you can use it to make authenticated requests to the Yes No API. The key should be included in the Authorization header of your HTTP requests as a Bearer token. Below is an example using curl, demonstrating how to generate synthetic data:
curl -X POST \
https://api.yesno.ai/v1/generate \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_YESNO_API_KEY' \
-d '{
"schema": {
"name": "string",
"email": "email",
"age": "integer(18, 65)"
},
"count": 10
}'
In this example:
YOUR_YESNO_API_KEYmust be replaced with the actual API key you generated from your Yes No dashboard.- The
-H 'Authorization: Bearer YOUR_YESNO_API_KEY'header carries the authentication credential. - The
-H 'Content-Type: application/json'header specifies the request body format. - The
-dflag provides the JSON payload, defining the schema and number of synthetic records to generate.
Yes No provides SDKs for multiple languages, including Python, Java, JavaScript, and C#. These SDKs abstract the details of constructing the HTTP request and handling authentication, simplifying integration. For instance, in Python, an authenticated request might look like this:
import os
from yesno_sdk import YesNoClient
api_key = os.environ.get("YESNO_API_KEY")
client = YesNoClient(api_key=api_key)
schema = {
"name": "string",
"email": "email",
"age": "integer(18, 65)"
}
# Generate 5 records
data = client.generate_data(schema=schema, count=5)
print(data)
This Python example demonstrates how the SDK handles the API key, typically passed during client initialization, simplifying subsequent API calls. For more detailed code examples and language-specific instructions, consult the Yes No API reference documentation.
Security best practices
Securing your Yes No API keys is paramount to maintaining the integrity and privacy of your data generation workflows. Adhering to these best practices reduces the risk of unauthorized access and potential service disruptions:
- Treat API Keys as Sensitive Credentials: Your API key provides full access to your Yes No account's capabilities. Treat it with the same care as a password or private cryptographic key.
- Do Not Embed Keys Directly in Code: Avoid hardcoding API keys directly into your application's source code. This practice can lead to accidental exposure if the code is committed to version control systems like Git, especially public repositories. Instead, use environment variables, secret management services, or configuration files that are not publicly exposed. The AWS Secrets Manager documentation provides guidance on securely storing credentials.
- Use Environment Variables: For server-side applications, storing API keys in environment variables is a common and secure practice. This keeps keys out of your codebase and allows for easy rotation without code changes.
- Implement Least Privilege: If Yes No offers granular permissions for API keys (check the Yes No security documentation for details), configure keys with the minimum necessary permissions required for their specific tasks. This limits the damage if a key is compromised.
- Regularly Rotate API Keys: Periodically generate new API keys and revoke old ones. This practice, known as key rotation, reduces the window of opportunity for a compromised key to be exploited. A common rotation schedule is every 90 days, though this can vary based on your organization's security policies.
- Monitor API Key Usage: If Yes No provides audit logs or usage analytics, regularly review these to detect any unusual activity or suspicious access patterns that might indicate a compromised key.
- Restrict Access to API Keys: Limit who in your organization has access to generate, view, or manage API keys. Access should be granted only to personnel who require it for their job functions.
- Secure Development Environments: Ensure that all development, staging, and production environments where API keys are used are adequately secured, following robust network security and access control policies.
- Use HTTPS/TLS: Always ensure that all communications with the Yes No API occur over HTTPS/TLS. Yes No enforces this by default, but verifying your client-side implementation uses HTTPS is still a good practice. This encrypts data in transit, preventing eavesdropping and tampering. The MDN Web Docs on TLS explain the importance of secure transport.
- Revoke Compromised Keys Immediately: If you suspect an API key has been compromised, revoke it immediately through the Yes No dashboard and generate a new one.
By implementing these security best practices, developers can significantly enhance the protection of their Yes No integrations and ensure the secure generation and management of synthetic data.