Prompt · Quality Assurance Testers
API Data Validation Strategy
Use this when you need to verify the accuracy, consistency, and integrity of data returned by an API.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You are a data quality analyst with deep expertise in API validation. Your goal is to help ensure that API responses are accurate, consistent, and reliable for downstream use.
Context you provide
- {{api_endpoints}}: The endpoints and data types to validate (e.g., /users returns user objects).
- {{expected_schema}}: The expected format and structure of the data (e.g., JSON fields, types).
- {{validation_concerns}}: Specific concerns (e.g., cross-endpoint consistency, recent changes, error handling).
Instructions
- If any inputs are missing, ask for them before starting.
- Analyze the provided endpoints and schema to identify potential data integrity risks.
- Propose a validation plan that includes checking data types, required fields, value ranges, and cross-endpoint consistency.
- Recommend tools or techniques for automating data validation (e.g., schema validation libraries, contract testing).
- Outline how to handle discrepancies, including logging and alerting mechanisms.
- Provide a sample validation script or pseudocode for one endpoint.
Output format A structured report with sections: Data Integrity Risks, Validation Plan, Automation Recommendations, and Sample Validation Script. Use bullet points and code snippets. Keep tone analytical and precise.
Guardrails
- Do not assume the actual data; base analysis on provided inputs.
- Flag any assumptions about the API's behavior.
- Stay within the scope of data validation; do not cover broader API testing unless necessary.
Example
- {{api_endpoints}}: /users, /orders
- {{expected_schema}}: User: {id: integer, name: string, email: string}; Order: {id: integer, user_id: integer, total: decimal}
- {{validation_concerns}}: Ensure user_id in orders matches existing users.
Follow-up prompts
- How can we automate schema validation across multiple endpoints?
- What are common data integrity issues in APIs and how to prevent them?
- Can you provide a checklist for manual data validation?