{"openapi":"3.1.0","info":{"version":"2.7.0","title":"Yoast AI Specification","description":"JSON application API server for the Yoast AI implementation.","contact":{"email":"support@yoast.com"}},"servers":[{"url":"/api/v1"}],"paths":{"/":{"get":{"summary":"API Schema","description":"Returns a JSON object representing the API schema for Yoast AI in the OpenAPI Specification (OAS) v3 format.","operationId":"schema","responses":{"200":{"$ref":"#/components/responses/200Schema"},"429":{"$ref":"#/components/responses/429TooManyRequests"},"500":{"$ref":"#/components/responses/500InternalServerError"}}}},"/token/request":{"post":{"summary":"Request an access token","description":"Requests a new Yoast AI authentication token.\n- Performs a license check on the license_site_url.\n- Registers user consent.\n- Generates a JWT Access & Refresh token.\n- Sends the response payload through a callback, which verifies that only the licensed Web site can connect to Yoast AI.\n","tags":["Auth"],"operationId":"requestToken","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/TokenRequest"},{"$ref":"#/components/schemas/TokenCallbacks"},{"$ref":"#/components/schemas/CodeChallenge"}]}}}},"callbacks":{"RequestApproved":{"$ref":"#/components/callbacks/TokenRequestApprovedCallback"}},"responses":{"200":{"$ref":"#/components/responses/200Ok"},"400":{"$ref":"#/components/responses/400BadRequest","description":"Used when:\n* The request body failed validation against this specification.\n* The site confirmation callback to `callback_url` failed (`error_code: SITE_UNREACHABLE`), so it could not be verified that the site received its tokens."},"401":{"$ref":"#/components/responses/401UnauthorizedLegacy","description":"The requesting site could not provide a valid code_verifier that matches the code_challenge."},"403":{"$ref":"#/components/responses/403DomainMismatch"},"408":{"$ref":"#/components/responses/408RequestTimeout","description":"The site confirmation callback to `callback_url` did not respond in time."},"429":{"$ref":"#/components/responses/429TooManyRequests"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"The MyYoast license server could not be reached while validating the site's subscription."}}}},"/token/request-as-partner":{"post":{"summary":"Request an access token as a trusted partner","description":"Generates a JWT Access token for a user, using Yoast AI partner credentials.\n","tags":["Auth"],"operationId":"requestTokenAsPartner","security":[{"JWTPartnerTokenBearer":[]}],"responses":{"200":{"$ref":"#/components/responses/200PartnerObtainedToken"},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401UnauthorizedLegacy","description":"Missing or invalid partner credentials."},"408":{"$ref":"#/components/responses/408RequestTimeout"},"429":{"$ref":"#/components/responses/429TooManyRequests"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"The MyYoast license server could not be reached while validating the site's subscription."}}}},"/token/refresh":{"post":{"summary":"Request refreshed Yoast AI tokens.","description":"Use your JWT Refresh token to create new JWT Access & Refresh tokens.\n","tags":["Auth"],"operationId":"refreshToken","security":[{"JWTRefreshTokenBearer":[]}],"callbacks":{"RefreshApproved":{"$ref":"#/components/callbacks/RefreshRequestApprovedCallback"}},"responses":{"200":{"$ref":"#/components/responses/200Ok"},"400":{"$ref":"#/components/responses/400BadRequest","description":"The refresh confirmation callback to `refresh_callback_url` failed (`error_code: SITE_UNREACHABLE`), so it could not be verified that the site received its new tokens."},"401":{"$ref":"#/components/responses/401UnauthorizedLegacy","description":"Used when:\n* The refresh token was missing, invalid, expired, or was already consumed. Establish a new connection.\n* The site's callback responded with a `code_verifier` that does not match the `code_challenge`."},"408":{"$ref":"#/components/responses/408RequestTimeout","description":"The refresh confirmation callback to `refresh_callback_url` did not respond in time."},"429":{"$ref":"#/components/responses/429TooManyRequests"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"The MyYoast license server could not be reached while validating the site's subscription."}}}},"/token/invalidate":{"post":{"summary":"Invalidate your Yoast AI connection.","operationId":"invalidateToken","description":"Invalidates your Yoast AI connection by\n- Revoking the user's consent.\n- Invalidating the user's JWT Access & Refresh tokens.\n","tags":["Auth"],"security":[{"JWTAccessTokenBearer":[]}],"responses":{"200":{"$ref":"#/components/responses/200Ok"},"400":{"$ref":"#/components/responses/400BadRequest","description":"The request was malformed (e.g. invalid JSON or unknown query parameters); this operation performs no further input validation."},"401":{"$ref":"#/components/responses/401UnauthorizedLegacy","description":"The access token was missing, invalid, expired."},"429":{"$ref":"#/components/responses/429TooManyRequests"},"500":{"$ref":"#/components/responses/500InternalServerError"}}}},"/user/consent":{"post":{"summary":"Tracks the user's consent, enabling access to AI services.","description":"Track a user's consent to use the Yoast AI service.","tags":["Consent"],"operationId":"grantConsent","security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentGrantRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/200Ok"},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"403":{"$ref":"#/components/responses/403InsufficientScope"},"429":{"$ref":"#/components/responses/429TooManyRequests"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"The MyYoast license server could not be reached while resolving the site's licenses for an OAuth-authenticated request."}}},"delete":{"summary":"Tracks the user's consent revocation.","description":"Track a user's consent revocation to use the Yoast AI service, disabling access to AI services.","tags":["Consent"],"operationId":"revokeConsent","security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"},{"$ref":"#/components/parameters/ExternalUserIdQueryParam"}],"responses":{"200":{"$ref":"#/components/responses/200Ok"},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"403":{"$ref":"#/components/responses/403InsufficientScope"},"429":{"$ref":"#/components/responses/429TooManyRequests"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"The MyYoast license server could not be reached while resolving the site's licenses for an OAuth-authenticated request."}}}},"/openai/suggestions/bulk":{"post":{"summary":"Use OpenAI to generate SEO suggestions for many subjects at once","description":"Generate suggestions for good SEO titles or meta descriptions for up to 20 subjects in a single request. Each subject names its own `type`, so a batch may mix types; each subject is generated independently and returns its own result, so a single subject can fail without failing the whole batch. Bulk is a licensed-only feature: subjects whose type the site is not licensed for are returned as a per-item `MISSING_LICENSE` error (with `missing_licenses`); if every subject is unlicensed the whole call is rejected with a top-level 402 (payment required).","tags":["AI Generate"],"operationId":"openAiBulkSuggestions","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkGetSuggestions"},"example":{"subjects":[{"id":"101","type":"seo-title","content":"<p>Our Amsterdam bagel shop bakes fresh bagels daily…</p>","focus_keyphrase":"amsterdam bagels","language":"en-US","platform":"Google"},{"id":"102","type":"meta-description","content":"<p>Sourdough vs. yeasted bagels: what's the difference?</p>","focus_keyphrase":"sourdough bagels","language":"en-US"}]}}}},"responses":{"200":{"$ref":"#/components/responses/200BulkSuggestions"},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked"},"429":{"$ref":"#/components/responses/429TooManyRequests"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}},"/openai/suggestions/{type}":{"post":{"summary":"Use OpenAI to generate suggestions about your SEO","description":"Generate suggestions for good SEO titles and meta descriptions with OpenAI. The API will adjust the prompt according to the requested type to achieve the best result.","tags":["AI Generate"],"operationId":"openAiSuggestions","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"},{"name":"type","description":"The type of content to get suggestions for.","in":"path","required":true,"example":"seo-title","schema":{"enum":["seo-title","meta-description","product-seo-title","product-meta-description","taxonomy-seo-title","taxonomy-meta-description","product-taxonomy-seo-title","product-taxonomy-meta-description"]}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetSuggestions"}}}},"responses":{"200":{"$ref":"#/components/responses/200OSuggestions"},"400":{"$ref":"#/components/responses/400BadRequest","description":"Used when:\n* The request body failed validation against this specification.\n* The AI response could not be parsed or did not improve on the input (`error_code: MALFORMED_AI_RESPONSE`).\n* The AI response triggered the upstream content filter (`error_code: AI_CONTENT_FILTER`)."},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked"},"429":{"$ref":"#/components/responses/429TooManyRequestsAI","description":"Used when:\n* The upstream AI service rate-limited the request (`error_code: AI_RATE_LIMITED`).\n* The site has exhausted its free AI usage allowance (`error_code: USAGE_LIMIT_REACHED`).\n* The Cloudflare application rate limit for the resource was exhausted."},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"Used when:\n* The upstream AI service failed or was unavailable.\n* The MyYoast license server could not be reached while resolving the site's licenses for an OAuth-authenticated request."}}}},"/fix/assessments/seo-keyphrase-introduction":{"post":{"summary":"Keyphrase in introduction","description":"Generates a suggestion for improving your content for the _keyphrase in introduction_ assessment.","tags":["AI Optimize"],"operationId":"seoKeyphraseIntroduction","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeoAssessmentSubject"}}}},"responses":{"200":{"$ref":"#/components/responses/200OpenAISuggestions"},"400":{"$ref":"#/components/responses/400BadRequest","description":"Used when:\n* The request body failed validation against this specification.\n* The AI response could not be parsed or did not improve on the input (`error_code: MALFORMED_AI_RESPONSE`).\n* The AI response triggered the upstream content filter (`error_code: AI_CONTENT_FILTER`)."},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked"},"429":{"$ref":"#/components/responses/429TooManyRequestsAI","description":"Used when:\n* The upstream AI service rate-limited the request (`error_code: AI_RATE_LIMITED`).\n* The site has exhausted its free AI usage allowance (`error_code: USAGE_LIMIT_REACHED`).\n* The Cloudflare application rate limit for the resource was exhausted."},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"Used when:\n* The upstream AI service failed or was unavailable.\n* The MyYoast license server could not be reached while resolving the site's licenses for an OAuth-authenticated request."}}}},"/fix/assessments/seo-keyphrase-density":{"post":{"summary":"Keyphrase density","description":"Generates a suggestion for improving your content for the _keyphrase density_ assessment.","tags":["AI Optimize"],"operationId":"seoKeyphraseDensity","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeoAssessmentSubject"}}}},"responses":{"200":{"$ref":"#/components/responses/200OpenAISuggestions"},"400":{"$ref":"#/components/responses/400BadRequest","description":"Used when:\n* The request body failed validation against this specification.\n* The AI response could not be parsed or did not improve on the input (`error_code: MALFORMED_AI_RESPONSE`).\n* The AI response triggered the upstream content filter (`error_code: AI_CONTENT_FILTER`)."},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked"},"429":{"$ref":"#/components/responses/429TooManyRequestsAI","description":"Used when:\n* The upstream AI service rate-limited the request (`error_code: AI_RATE_LIMITED`).\n* The site has exhausted its free AI usage allowance (`error_code: USAGE_LIMIT_REACHED`).\n* The Cloudflare application rate limit for the resource was exhausted."},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"Used when:\n* The upstream AI service failed or was unavailable.\n* The MyYoast license server could not be reached while resolving the site's licenses for an OAuth-authenticated request."}}}},"/fix/assessments/seo-keyphrase-distribution":{"post":{"summary":"Keyphrase distribution","description":"Generates a suggestion for improving your content for the _keyphrase distribution_ assessment.","tags":["AI Optimize"],"operationId":"seoKeyphraseDistribution","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeoAssessmentSubject"}}}},"responses":{"200":{"$ref":"#/components/responses/200OpenAISuggestions"},"400":{"$ref":"#/components/responses/400BadRequest","description":"Used when:\n* The request body failed validation against this specification.\n* The AI response could not be parsed or did not improve on the input (`error_code: MALFORMED_AI_RESPONSE`).\n* The AI response triggered the upstream content filter (`error_code: AI_CONTENT_FILTER`)."},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked"},"429":{"$ref":"#/components/responses/429TooManyRequestsAI","description":"Used when:\n* The upstream AI service rate-limited the request (`error_code: AI_RATE_LIMITED`).\n* The site has exhausted its free AI usage allowance (`error_code: USAGE_LIMIT_REACHED`).\n* The Cloudflare application rate limit for the resource was exhausted."},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"Used when:\n* The upstream AI service failed or was unavailable.\n* The MyYoast license server could not be reached while resolving the site's licenses for an OAuth-authenticated request."}}}},"/fix/assessments/seo-keyphrase-subheadings":{"post":{"summary":"Keyphrase in subheadings","description":"Generates a suggestion for improving your content for the _keyphrase in subheadings_ assessment.","tags":["AI Optimize"],"operationId":"seoKeyphraseSubheadings","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeoAssessmentSubject"}}}},"responses":{"200":{"$ref":"#/components/responses/200OpenAISuggestions"},"400":{"$ref":"#/components/responses/400BadRequest","description":"Used when:\n* The request body failed validation against this specification.\n* The AI response could not be parsed or did not improve on the input (`error_code: MALFORMED_AI_RESPONSE`).\n* The AI response triggered the upstream content filter (`error_code: AI_CONTENT_FILTER`)."},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked"},"429":{"$ref":"#/components/responses/429TooManyRequestsAI","description":"Used when:\n* The upstream AI service rate-limited the request (`error_code: AI_RATE_LIMITED`).\n* The site has exhausted its free AI usage allowance (`error_code: USAGE_LIMIT_REACHED`).\n* The Cloudflare application rate limit for the resource was exhausted."},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"Used when:\n* The upstream AI service failed or was unavailable.\n* The MyYoast license server could not be reached while resolving the site's licenses for an OAuth-authenticated request."}}}},"/fix/assessments/read-sentence-length":{"post":{"summary":"Sentence length","description":"Generates a suggestion for improving your content for the _sentence length_ assessment.","tags":["AI Optimize"],"operationId":"readSentenceLength","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadabilityAssessmentSubject"}}}},"responses":{"200":{"$ref":"#/components/responses/200OpenAISuggestions"},"400":{"$ref":"#/components/responses/400BadRequest","description":"Used when:\n* The request body failed validation against this specification.\n* The AI response could not be parsed or did not improve on the input (`error_code: MALFORMED_AI_RESPONSE`).\n* The AI response triggered the upstream content filter (`error_code: AI_CONTENT_FILTER`)."},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked"},"429":{"$ref":"#/components/responses/429TooManyRequestsAI","description":"Used when:\n* The upstream AI service rate-limited the request (`error_code: AI_RATE_LIMITED`).\n* The site has exhausted its free AI usage allowance (`error_code: USAGE_LIMIT_REACHED`).\n* The Cloudflare application rate limit for the resource was exhausted."},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"Used when:\n* The upstream AI service failed or was unavailable.\n* The MyYoast license server could not be reached while resolving the site's licenses for an OAuth-authenticated request."}}}},"/fix/assessments/read-paragraph-length":{"post":{"summary":"Paragraph length","description":"Generates a suggestion for improving your content for the _paragraph length_ assessment.","tags":["AI Optimize"],"operationId":"readParagraphLength","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadabilityAssessmentSubject"}}}},"responses":{"200":{"$ref":"#/components/responses/200OpenAISuggestions"},"400":{"$ref":"#/components/responses/400BadRequest","description":"Used when:\n* The request body failed validation against this specification.\n* The AI response could not be parsed or did not improve on the input (`error_code: MALFORMED_AI_RESPONSE`).\n* The AI response triggered the upstream content filter (`error_code: AI_CONTENT_FILTER`)."},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked"},"429":{"$ref":"#/components/responses/429TooManyRequestsAI","description":"Used when:\n* The upstream AI service rate-limited the request (`error_code: AI_RATE_LIMITED`).\n* The site has exhausted its free AI usage allowance (`error_code: USAGE_LIMIT_REACHED`).\n* The Cloudflare application rate limit for the resource was exhausted."},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"Used when:\n* The upstream AI service failed or was unavailable.\n* The MyYoast license server could not be reached while resolving the site's licenses for an OAuth-authenticated request."}}}},"/openai/summary":{"post":{"summary":"AI Summarize","description":"Generates a quick summary highlighting the main takeaways from your content.","tags":["AI Summarize"],"operationId":"summaryGenerate","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummaryGenerateSubject"}}}},"responses":{"200":{"$ref":"#/components/responses/200SummarizeSuggestions"},"400":{"$ref":"#/components/responses/400BadRequest","description":"Used when:\n* The request body failed validation against this specification.\n* The AI response could not be parsed or did not improve on the input (`error_code: MALFORMED_AI_RESPONSE`).\n* The AI response triggered the upstream content filter (`error_code: AI_CONTENT_FILTER`)."},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked"},"429":{"$ref":"#/components/responses/429TooManyRequestsAI","description":"Used when:\n* The upstream AI service rate-limited the request (`error_code: AI_RATE_LIMITED`).\n* The site has exhausted its free AI usage allowance (`error_code: USAGE_LIMIT_REACHED`).\n* The Cloudflare application rate limit for the resource was exhausted."},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"Used when:\n* The upstream AI service failed or was unavailable.\n* The MyYoast license server could not be reached while resolving the site's licenses for an OAuth-authenticated request."}}}},"/content-planner/next-post-suggestions":{"post":{"summary":"Content planner - next post suggestions","description":"Suggests 5 new post ideas with the biggest SEO impact for the site, based on existing content.","tags":["AI Content Planner"],"operationId":"contentPlannerNextPostSuggestions","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentPlannerPostSubject"}}}},"responses":{"200":{"$ref":"#/components/responses/200ContentPlannerSuggestions"},"400":{"$ref":"#/components/responses/400BadRequest","description":"Used when:\n* The request body failed validation against this specification.\n* The AI response could not be parsed or did not improve on the input (`error_code: MALFORMED_AI_RESPONSE`).\n* The AI response triggered the upstream content filter (`error_code: AI_CONTENT_FILTER`)."},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked","description":"The user has revoked their consent for AI usage. Have the user grant consent again to restore access."},"429":{"$ref":"#/components/responses/429TooManyRequestsAI","description":"Used when:\n* The upstream AI service rate-limited the request (`error_code: AI_RATE_LIMITED`).\n* The site has exhausted its free AI usage allowance (`error_code: USAGE_LIMIT_REACHED`).\n* The Cloudflare application rate limit for the resource was exhausted."},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"The upstream AI service failed or was unavailable."}}}},"/content-planner/next-post-outline":{"post":{"summary":"Content planner - next post outline","description":"Generates a structured outline for a new post.","tags":["AI Content Planner"],"operationId":"contentPlannerNextPostOutline","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentPlannerOutlineSubject"}}}},"responses":{"200":{"$ref":"#/components/responses/200ContentPlannerOutline"},"400":{"$ref":"#/components/responses/400BadRequest","description":"Used when:\n* The request body failed validation against this specification.\n* The AI response could not be parsed or did not improve on the input (`error_code: MALFORMED_AI_RESPONSE`).\n* The AI response triggered the upstream content filter (`error_code: AI_CONTENT_FILTER`)."},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked","description":"The user has revoked their consent for AI usage. Have the user grant consent again to restore access."},"429":{"$ref":"#/components/responses/429TooManyRequestsAI","description":"Used when:\n* The upstream AI service rate-limited the request (`error_code: AI_RATE_LIMITED`).\n* The site has exhausted its free AI usage allowance (`error_code: USAGE_LIMIT_REACHED`).\n* The Cloudflare application rate limit for the resource was exhausted."},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"The upstream AI service failed or was unavailable."}}}},"/alt-text-generator/generate":{"post":{"summary":"Generate alt text for product images","description":"Generate an alt text for up to 20 product images in a single request. Each image is generated independently and returns its own result, so a single image can fail without failing the whole batch. Alt text is a licensed-only feature: unlicensed sites are rejected with a top-level 402 (payment required) before any generation runs. The image travels as a URL that the AI provider fetches, so it must be publicly reachable.","tags":["AI Alt Text"],"operationId":"generateAltText","x-middleware":["requireConsent"],"security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AltTextGenerate"},"example":{"subjects":[{"id":"11","image_url":"https://example.com/wp-content/uploads/red-sneaker.jpg","image_types":["gallery","variation"],"focus_keyphrase":"sneakers","language":"en-US","product_title":"UrbanFlex Everyday Sneakers","variation_attributes":{"color":"red"}},{"id":"12","image_url":"https://example.com/wp-content/uploads/main-sneaker.jpg","image_types":["featured"],"focus_keyphrase":"sneakers","language":"en-GB","product_title":"UrbanFlex Everyday Sneakers","existing_alt_text":"Old alt text"}]}}}},"responses":{"200":{"$ref":"#/components/responses/200AltTextSuggestions"},"400":{"$ref":"#/components/responses/400BadRequest"},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"402":{"$ref":"#/components/responses/402PaymentRequired"},"403":{"$ref":"#/components/responses/403ConsentRevoked"},"429":{"$ref":"#/components/responses/429TooManyRequests"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable"}}}},"/usage/{period}":{"get":{"summary":"Get the usage statistics for a site.","description":"Get the usage statistics for a site in the given period.","tags":["Usage"],"operationId":"getUsageForSite","security":[{"JWTAccessTokenBearer":[]},{"MyYoastOAuthBearer":["service:ai:consume"]}],"parameters":[{"$ref":"#/components/parameters/DPoPHeader"},{"name":"period","description":"The period to get the usage statistics for. right now. that period refers to a specific month, or to free-usages 1.","in":"path","required":true,"examples":{"month":{"summary":"For a specific month","value":"2024-06"},"freeUsages":{"summary":"For the free usages","value":"free-usages"}},"schema":{"type":"string"}},{"$ref":"#/components/parameters/ExternalUserIdQueryParam"}],"responses":{"200":{"$ref":"#/components/responses/200Usage"},"400":{"$ref":"#/components/responses/400BadRequest","description":"The `period` path parameter is not a valid `YYYY-MM` month or `free-usages`."},"401":{"$ref":"#/components/responses/401UnauthorizedDual"},"403":{"$ref":"#/components/responses/403InsufficientScope"},"429":{"$ref":"#/components/responses/429TooManyRequests"},"500":{"$ref":"#/components/responses/500InternalServerError"},"503":{"$ref":"#/components/responses/503ServiceUnavailable","description":"The MyYoast license server could not be reached while resolving the site's licenses for an OAuth-authenticated request."}}}}},"components":{"callbacks":{"TokenRequestApprovedCallback":{"{$request.body.callback_url}":{"post":{"summary":"The request has been approved. Sending the payload.","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/JSONWebTokens"},{"$ref":"#/components/schemas/CodeChallenge"}]}}}},"responses":{"200":{"$ref":"#/components/responses/200OkCallback"},"401":{"$ref":"#/components/responses/401UnauthorizedCallback"}}}}},"RefreshRequestApprovedCallback":{"{$request.jwt.refresh_callback_url}":{"post":{"summary":"The request has been approved. Sending the payload.","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/JSONWebTokens"},{"$ref":"#/components/schemas/CodeChallenge"}]}}}},"responses":{"200":{"$ref":"#/components/responses/200OkCallback"},"401":{"$ref":"#/components/responses/401UnauthorizedCallback"}}}}}},"parameters":{"ExternalUserIdQueryParam":{"name":"user_id","in":"query","required":false,"description":"An identifier, assigned by the API consumer, for the user the request is on behalf of. It only needs to be unique and stable within the consuming site; Yoast AI treats it as an opaque string and combines it with the site to derive an anonymized internal id. Required when authenticating via the MyYoastOAuthBearer scheme; ignored on requests authenticated via legacy schemes (where the user id comes from the access token instead).","schema":{"type":"string","minLength":1,"example":"wp-user-42"}},"DPoPHeader":{"name":"DPoP","in":"header","required":false,"description":"RFC 9449 DPoP proof JWT. Required when the MyYoast access token is DPoP-bound (i.e. carries a `cnf.jkt` claim); in that case the `Authorization` header MUST use the `DPoP` scheme instead of `Bearer`, and the proof MUST be signed by the key whose JWK thumbprint matches `cnf.jkt`. Ignored on Bearer-only requests and on requests authenticated via the legacy JWT schemes. The Authorization Server decides whether to issue a DPoP-bound token; Yoast AI accepts either presentation.","schema":{"type":"string"}}},"schemas":{"Error":{"type":"object","properties":{"message":{"type":"string"},"path":{"type":"string"},"errorCode":{"type":"string"}}},"Errors":{"type":"array","items":{"$ref":"#/components/schemas/Error"}},"Message":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer"}}},"ErrorCode":{"type":"object","properties":{"error_code":{"type":"string","example":"AI_CONTENT_FILTER"}}},"CodedMessage":{"allOf":[{"$ref":"#/components/schemas/Message"},{"$ref":"#/components/schemas/ErrorCode"}]},"FreeUsageLimit":{"allOf":[{"$ref":"#/components/schemas/Message"},{"$ref":"#/components/schemas/ErrorCode"},{"$ref":"#/components/schemas/MissingLicenses"}]},"ValidationError":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer"},"errors":{"$ref":"#/components/schemas/Errors"}}},"TokenRequest":{"type":"object","required":["user_id","license_site_url","service"],"properties":{"user_id":{"type":"string","example":"123456789","description":"A reference to the user requesting access. This value is unique to the licensed site."},"license_site_url":{"type":"string","format":"url","example":"https://example.com","description":"The Uniform Resource Locator (URL) of the Web site that has a license associated with it on MyYoast."},"service":{"type":"string","description":"The Yoast AI service to request a token for.","example":"openai","enum":["openai"]}}},"TokenCallbacks":{"type":"object","required":["callback_url","refresh_callback_url"],"properties":{"callback_url":{"type":"string","format":"url","description":"The callback URL used to send the token request payload to.","example":"https://example.com/yoast-ai-callback"},"refresh_callback_url":{"type":"string","format":"url","description":"The callback URL used to send the token refresh payload to.","example":"https://example.com/yoast-ai-callback"}}},"JSONWebTokens":{"type":"object","required":["user_id","refresh_jwt","access_jwt"],"properties":{"user_id":{"type":"string","example":"123456789","description":"A reference to the user that is authorized with these tokens."},"refresh_jwt":{"type":"string","description":"The JWT refresh token used to request new tokens once the JWT access token expires."},"access_jwt":{"type":"string","description":"A short-lived (1-hour) JWT, used to authenticate to this API on behalf of the connected site."}}},"PartnerObtainedJSONWebTokens":{"type":"object","required":["tokens"],"properties":{"tokens":{"type":"object","required":["access_token"],"properties":{"access_token":{"type":"string","description":"A short-lived (15-minute) JWT, used to authenticate to this API on behalf of the connected site."}}}}},"CodeChallenge":{"type":"object","required":["code_challenge"],"properties":{"code_challenge":{"type":"string","description":"A hash that is used to verify that the site that receives the callback is the same actor as the caller of the token/refresh request. It is also compared to an unhashed code_verifier to make sure that the callback was indeed handled by the original caller and not a third party."}}},"CodeVerifier":{"type":"object","required":["code_verifier"],"properties":{"code_verifier":{"type":"string","description":"The value of the code_challenge before it was hashed. This is compared to the code_challenge to verify that the callback was handled by the same site that requested the token."}}},"MissingLicenses":{"type":"object","required":["missing_licenses"],"properties":{"missing_licenses":{"type":"array","description":"The missing licenses.","items":{"type":"string","example":"Yoast SEO Premium","description":"The name of the product you can have a license for."}}}},"GetSuggestions":{"type":"object","required":["service","subject"],"properties":{"user_id":{"$ref":"#/components/schemas/BodyParameterExternalUserId"},"service":{"$ref":"#/components/schemas/BodyParameterService"},"subject":{"type":"object","required":["content","focus_keyphrase","language"],"properties":{"content":{"$ref":"#/components/schemas/BodyParameterContent"},"focus_keyphrase":{"$ref":"#/components/schemas/BodyParameterFocusKeyphrase"},"language":{"$ref":"#/components/schemas/BodyParameterLanguage"},"platform":{"$ref":"#/components/schemas/BodyParameterPlatform"}}}}},"BulkGetSuggestions":{"type":"object","required":["subjects"],"properties":{"user_id":{"$ref":"#/components/schemas/BodyParameterExternalUserId"},"subjects":{"type":"array","minItems":1,"maxItems":20,"description":"The subjects to generate suggestions for. One result is returned per subject.","items":{"$ref":"#/components/schemas/BulkSubject"}}}},"BulkSubject":{"type":"object","required":["id","type","content","focus_keyphrase"],"properties":{"id":{"$ref":"#/components/schemas/BodyParameterSubjectId"},"type":{"$ref":"#/components/schemas/BodyParameterSuggestionType"},"content":{"$ref":"#/components/schemas/BodyParameterContent"},"focus_keyphrase":{"$ref":"#/components/schemas/BodyParameterFocusKeyphrase"},"language":{"$ref":"#/components/schemas/BodyParameterLanguage"},"platform":{"$ref":"#/components/schemas/BodyParameterPlatform"}}},"BulkSuggestions":{"type":"object","required":["summary","results","usage"],"properties":{"summary":{"$ref":"#/components/schemas/BulkSummary"},"results":{"type":"array","items":{"$ref":"#/components/schemas/BulkResultItem"}},"usage":{"$ref":"#/components/schemas/BulkUsage"}}},"BulkSummary":{"type":"object","required":["total","succeeded","failed"],"properties":{"total":{"type":"integer","example":2,"description":"The number of subjects in the request."},"succeeded":{"type":"integer","example":1,"description":"The number of subjects that returned suggestions."},"failed":{"type":"integer","example":1,"description":"The number of subjects that returned an error."}}},"BulkResultItem":{"oneOf":[{"$ref":"#/components/schemas/BulkResultSuccess"},{"$ref":"#/components/schemas/BulkResultError"}],"discriminator":{"propertyName":"status","mapping":{"success":"#/components/schemas/BulkResultSuccess","error":"#/components/schemas/BulkResultError"}}},"BulkResultSuccess":{"type":"object","additionalProperties":false,"required":["id","index","status","choices"],"properties":{"id":{"$ref":"#/components/schemas/BodyParameterSubjectId"},"index":{"type":"integer","example":0,"description":"The zero-based position of this subject in the request."},"status":{"type":"string","description":"The per-subject outcome, and the discriminator for this oneOf: \"success\" selects this schema, \"error\" selects BulkResultError. The per-subject result never carries an HTTP status — the HTTP status is for the batch as a whole.","enum":["success"]},"choices":{"type":"array","minItems":1,"description":"The generated suggestions. The bulk prompts currently return a single suggestion, but the array is not capped so more may be returned in future without a contract change.","items":{"type":"object","additionalProperties":false,"required":["text","index"],"properties":{"text":{"type":"string","description":"The generated suggestion text."},"index":{"type":"integer","example":0,"description":"The zero-based position of the choice in the array."}}}}}},"BulkResultError":{"type":"object","additionalProperties":false,"required":["id","index","status","error_code","message"],"properties":{"id":{"$ref":"#/components/schemas/BodyParameterSubjectId"},"index":{"type":"integer","example":1,"description":"The zero-based position of this subject in the request."},"status":{"type":"string","description":"The per-subject outcome, and the discriminator for this oneOf: \"error\" selects this schema, \"success\" selects BulkResultSuccess. The per-subject result never carries an HTTP status — the HTTP status is for the batch as a whole.","enum":["error"]},"error_code":{"type":"string","description":"The per-subject failure reason. AI failures (filter/rate-limit/malformed/timeout/unknown) are never escalated to a top-level HTTP status. MISSING_LICENSE means the site is not licensed for this subject's type (bulk is licensed-only); it appears per-item when at least one other subject is licensed, and escalates to a top-level 402 when every subject is unlicensed.","enum":["AI_CONTENT_FILTER","AI_RATE_LIMITED","MALFORMED_AI_RESPONSE","AI_TIMEOUT","MISSING_LICENSE","UNKNOWN"]},"message":{"type":"string"},"missing_licenses":{"description":"Present only on MISSING_LICENSE items — the licenses that would unlock this subject's type.","type":"array","items":{"type":"string","example":"Yoast WooCommerce SEO"}}}},"BulkUsage":{"type":"object","required":["totalUsed"],"description":"Usage for the current licensed period (YYYY-MM), computed identically to the usage endpoint. Bulk is licensed-only, so this always reports the licensed period (limit 100).","properties":{"totalUsed":{"type":"object","properties":{"license":{"type":"integer","example":42,"description":"The number of usages recorded for the site in the current period."},"user":{"type":"integer","example":24,"description":"The number of usages recorded for the current user in the current period."},"limit":{"type":"integer","example":100,"description":"The usage limit for the licensed period."}}}}},"AltTextGenerate":{"type":"object","required":["subjects"],"properties":{"user_id":{"$ref":"#/components/schemas/BodyParameterExternalUserId"},"subjects":{"type":"array","minItems":1,"maxItems":20,"description":"The product images to generate alt text for. One result is returned per subject.","items":{"$ref":"#/components/schemas/AltTextSubject"}}}},"AltTextSubject":{"type":"object","additionalProperties":false,"required":["id","image_url","image_types","focus_keyphrase","language"],"properties":{"id":{"$ref":"#/components/schemas/BodyParameterSubjectId"},"image_url":{"type":"string","format":"uri","pattern":"^https?://","maxLength":2048,"description":"The URL of the image. The AI provider fetches it, so it must be publicly reachable — local, intranet or password-protected URLs fail with a per-item error."},"image_types":{"type":"array","minItems":1,"uniqueItems":true,"description":"All the places the image is used on the product.","items":{"type":"string","enum":["featured","gallery","variation"]}},"focus_keyphrase":{"$ref":"#/components/schemas/BodyParameterFocusKeyphrase"},"language":{"$ref":"#/components/schemas/BodyParameterLanguage"},"product_title":{"type":"string","description":"The title of the product the image belongs to."},"product_short_description":{"type":"string","description":"The short description of the product."},"attributes":{"type":"array","maxItems":10,"description":"The attributes of the product, limited to 10.","items":{"type":"string"}},"existing_alt_text":{"type":"string","description":"The current alt text of the image."},"variation_attributes":{"type":"object","description":"The attributes shared by every variation the image is used for.","additionalProperties":{"type":"string"}}}},"AltTextSuggestions":{"type":"object","required":["summary","results","usage"],"properties":{"summary":{"$ref":"#/components/schemas/AltTextSummary"},"results":{"type":"array","items":{"$ref":"#/components/schemas/AltTextResultItem"}},"usage":{"$ref":"#/components/schemas/AltTextUsage"}}},"AltTextSummary":{"type":"object","required":["total","succeeded","failed"],"properties":{"total":{"type":"integer","example":2,"description":"The number of images in the request."},"succeeded":{"type":"integer","example":1,"description":"The number of images that returned an alt text."},"failed":{"type":"integer","example":1,"description":"The number of images that returned an error."}}},"AltTextResultItem":{"oneOf":[{"$ref":"#/components/schemas/AltTextResultSuccess"},{"$ref":"#/components/schemas/AltTextResultError"}],"discriminator":{"propertyName":"status","mapping":{"success":"#/components/schemas/AltTextResultSuccess","error":"#/components/schemas/AltTextResultError"}}},"AltTextResultSuccess":{"type":"object","additionalProperties":false,"required":["id","index","status","choices"],"properties":{"id":{"$ref":"#/components/schemas/BodyParameterSubjectId"},"index":{"type":"integer","example":0,"description":"The zero-based position of this image in the request."},"status":{"type":"string","description":"The per-image outcome, and the discriminator for this oneOf: \"success\" selects this schema, \"error\" selects AltTextResultError. The per-image result never carries an HTTP status — the HTTP status is for the batch as a whole.","enum":["success"]},"choices":{"type":"array","minItems":1,"description":"The generated alt text. The prompt currently returns a single alt text, but the array is not capped so more may be returned in future without a contract change.","items":{"type":"object","additionalProperties":false,"required":["text","index"],"properties":{"text":{"type":"string","description":"The generated alt text."},"index":{"type":"integer","example":0,"description":"The zero-based position of the choice in the array."}}}}}},"AltTextResultError":{"type":"object","additionalProperties":false,"required":["id","index","status","error_code","message"],"properties":{"id":{"$ref":"#/components/schemas/BodyParameterSubjectId"},"index":{"type":"integer","example":1,"description":"The zero-based position of this image in the request."},"status":{"type":"string","description":"The per-image outcome, and the discriminator for this oneOf: \"error\" selects this schema, \"success\" selects AltTextResultSuccess.","enum":["error"]},"error_code":{"type":"string","description":"The per-image failure reason. AI failures are never escalated to a top-level HTTP status unless every image fails on infrastructure (503). IMAGE_NOT_FETCHABLE means the AI provider could not download the image URL — it must be publicly reachable, so local, intranet and password-protected URLs fail this way. Unlike bulk suggestions there is no per-item MISSING_LICENSE: alt text is served by a single prompt, so an unlicensed site is rejected whole-call with a top-level 402 before any generation runs.","enum":["AI_CONTENT_FILTER","AI_RATE_LIMITED","IMAGE_NOT_FETCHABLE","MALFORMED_AI_RESPONSE","AI_TIMEOUT","UNKNOWN"]},"message":{"type":"string"}}},"AltTextUsage":{"type":"object","required":["totalUsed"],"description":"Usage for the current licensed period (YYYY-MM), computed identically to the usage endpoint. Alt text is licensed-only, so this always reports the licensed period (limit 100). One usage entry is recorded per call, regardless of the number of images.","properties":{"totalUsed":{"type":"object","properties":{"license":{"type":"integer","example":42,"description":"The number of usages recorded for the site in the current period."},"user":{"type":"integer","example":24,"description":"The number of usages recorded for the current user in the current period."},"limit":{"type":"integer","example":100,"description":"The usage limit for the licensed period."}}}}},"SeoAssessmentSubject":{"type":"object","required":["service","subject"],"properties":{"user_id":{"$ref":"#/components/schemas/BodyParameterExternalUserId"},"service":{"$ref":"#/components/schemas/BodyParameterService"},"subject":{"type":"object","required":["content","focus_keyphrase","language"],"properties":{"content":{"$ref":"#/components/schemas/BodyParameterContent"},"focus_keyphrase":{"$ref":"#/components/schemas/BodyParameterFocusKeyphrase"},"language":{"$ref":"#/components/schemas/BodyParameterLanguage"},"synonyms":{"$ref":"#/components/schemas/BodyParameterSynonyms"}}}}},"ReadabilityAssessmentSubject":{"type":"object","required":["service","subject"],"properties":{"user_id":{"$ref":"#/components/schemas/BodyParameterExternalUserId"},"service":{"$ref":"#/components/schemas/BodyParameterService"},"subject":{"type":"object","required":["content","language"],"properties":{"content":{"$ref":"#/components/schemas/BodyParameterContent"},"language":{"$ref":"#/components/schemas/BodyParameterLanguage"}}}}},"SummaryGenerateSubject":{"type":"object","required":["service","subject"],"properties":{"user_id":{"$ref":"#/components/schemas/BodyParameterExternalUserId"},"service":{"$ref":"#/components/schemas/BodyParameterService"},"subject":{"type":"object","required":["content","language"],"properties":{"content":{"$ref":"#/components/schemas/BodyParameterContent"},"focus_keyphrase":{"$ref":"#/components/schemas/BodyParameterFocusKeyphrase"},"language":{"$ref":"#/components/schemas/BodyParameterLanguage"}}}}},"ContentPlannerAboutPage":{"type":"object","description":"A summary of the site's about page, used to provide context about the site.","required":["title","description"],"additionalProperties":false,"properties":{"title":{"type":["string","null"],"description":"The title of the about page."},"description":{"type":["string","null"],"description":"The meta description of the site's about page."}}},"ContentPlannerPostSubject":{"type":"object","required":["subject"],"additionalProperties":false,"properties":{"user_id":{"$ref":"#/components/schemas/BodyParameterExternalUserId"},"subject":{"type":"object","required":["content","language"],"additionalProperties":false,"properties":{"content":{"type":"object","required":["posts"],"additionalProperties":false,"properties":{"about_page":{"$ref":"#/components/schemas/ContentPlannerAboutPage"},"posts":{"type":"array","description":"A list of the most recent posts on the site.","items":{"type":"object","required":["title","description","primary_focus_keyword","category","is_cornerstone","last_modified"],"additionalProperties":false,"properties":{"title":{"type":["string","null"],"description":"The title of the post."},"description":{"type":["string","null"],"description":"The meta description of the post."},"primary_focus_keyword":{"type":["string","null"],"description":"The primary focus keyword of the post."},"category":{"type":["object","null"],"description":"The category the post belongs to.","required":["name","id"],"additionalProperties":false,"properties":{"name":{"type":"string","description":"The name of the category."},"id":{"type":"integer","description":"The ID of the category."}}},"is_cornerstone":{"type":"integer","enum":[0,1],"description":"Whether the post is marked as cornerstone content."},"last_modified":{"type":"string","description":"The date and time the post was last modified.","example":"2022-06-02 06:52:37"},"schema_article_type":{"type":"string","enum":["SocialMediaPosting","NewsArticle","AdvertiserContentArticle","SatiricalArticle","ScholarlyArticle","TechArticle","Report"],"description":"The schema article type of the post."}}}}}},"language":{"$ref":"#/components/schemas/BodyParameterLanguage"}}}}},"ContentPlannerOutlineSubject":{"type":"object","required":["subject"],"additionalProperties":false,"properties":{"user_id":{"$ref":"#/components/schemas/BodyParameterExternalUserId"},"subject":{"type":"object","required":["content","language"],"additionalProperties":false,"properties":{"content":{"type":"object","required":["new_post_metadata","existing_posts"],"additionalProperties":false,"properties":{"new_post_metadata":{"type":"object","description":"Metadata for the new post to generate an outline for.","required":["title","keyphrase","meta_description","intent","category","explanation"],"additionalProperties":false,"properties":{"title":{"type":"string","description":"The title of the new post."},"keyphrase":{"type":"string","description":"The primary focus keyphrase of the new post."},"meta_description":{"type":"string","description":"The meta description of the new post."},"intent":{"type":"string","enum":["informational","commercial"],"description":"The search intent that the new post is optimized for."},"category":{"type":"object","description":"The category the new post belongs to. If no category applies, name should be \\\"\\\" and id -1.","required":["name","id"],"additionalProperties":false,"properties":{"name":{"type":"string","description":"The name of the category."},"id":{"type":"integer","description":"The ID of the category."}}},"explanation":{"type":"string","description":"An explanation of why this post was suggested."}}},"about_page":{"$ref":"#/components/schemas/ContentPlannerAboutPage"},"existing_posts":{"type":"array","description":"A list of the most recent posts on the site.","items":{"type":"object","required":["title","description"],"additionalProperties":false,"properties":{"title":{"type":["string","null"],"description":"The title of the post."},"description":{"type":["string","null"],"description":"The meta description of the post."}}}}}},"language":{"$ref":"#/components/schemas/BodyParameterLanguage"}}}}},"ContentPlannerSuggestions":{"type":"object","additionalProperties":false,"properties":{"choices":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["index","title","keyphrase","meta_description","intent","category","explanation"],"properties":{"index":{"type":"integer"},"title":{"type":"string"},"keyphrase":{"type":"string"},"meta_description":{"type":"string"},"intent":{"type":"string","enum":["informational","commercial"]},"category":{"type":"object","required":["name","id"],"additionalProperties":false,"properties":{"name":{"type":"string"},"id":{"type":"integer"}}},"explanation":{"type":"string"}}}}}},"ContentPlannerOutline":{"type":"object","additionalProperties":false,"properties":{"choices":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["index","subheading_text","content_notes"],"properties":{"index":{"type":"integer"},"subheading_text":{"type":"string"},"content_notes":{"type":"array","items":{"type":"string"}}}}}}},"SummarizeSuggestions":{"type":"object","properties":{"choices":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"index":{"type":"integer","example":0}}}}}},"OpenAISuggestions":{"type":"object","properties":{"id":{"type":"string","example":"cmpl-7GSTiVOv8yl1pZssFr5hBlIDjAbcD"},"object":{"type":"string","example":"text_completion"},"created":{"type":"integer","description":"A timestamp of when the suggestion was created.","example":1684157074},"model":{"type":"string","example":"text-davinci-003"},"choices":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"index":{"type":"integer","example":0},"logprobs":{"example":null},"finish_reason":{"type":"string","example":"length"}}}},"usage":{"type":"object","properties":{"prompt_tokens":{"type":"integer","example":3},"completion_tokens":{"type":"integer","example":16},"total_tokens":{"type":"integer","example":19}}}}},"Suggestions":{"type":"object","properties":{"choices":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"index":{"type":"integer","example":0}}}}}},"AllUsageStatistics":{"type":"object","properties":{"totalUsed":{"$ref":"#/components/schemas/Usage"},"perPrompt":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Usage"},"example":{"suggestions/seo-title":{"license":59,"user":40},"/fix/assessments/seo-keyphrase-introduction":{"license":1,"user":0}}}}},"Usage":{"type":"object","properties":{"license":{"type":"integer","example":60},"user":{"type":"integer","example":40}}},"ConnectionStatus":{"type":"object","properties":{"needs_reconnect":{"type":"boolean","description":"The Yoast AI connection needs to be recreated for it to start working again."}}},"BodyParameterService":{"type":"string","description":"The Yoast AI service to request a token for.","example":"openai","enum":["openai"]},"BodyParameterContent":{"type":"string","minLength":1,"description":"Content used to infer smart SEO suggestions, possibly containing HTML."},"BodyParameterFocusKeyphrase":{"type":"string","minLength":1,"description":"The search term that you want your content to rank for most."},"BodyParameterLanguage":{"type":"string","example":"nl","default":"en-US","pattern":"^[a-z]{2,3}(-[A-Z]{2})?$","externalDocs":{"url":"https://www.andiamo.co.uk/resources/iso-language-codes/"},"description":"An ISO 639 language code of the language the content is most likely written in."},"BodyParameterPlatform":{"type":"string","example":"Google","minLength":1,"description":"For which platform the completions should be tailored.","default":"Google","enum":["Google","Twitter","Facebook"]},"BodyParameterSynonyms":{"type":"array","items":{"type":"string","example":"keyword","description":"A list of synonyms for the focus keyphrase."}},"BodyParameterSubjectId":{"type":"string","minLength":1,"example":"101","description":"A client-provided identifier for the subject, echoed back on the matching result item."},"BodyParameterSuggestionType":{"type":"string","example":"seo-title","description":"The type of content to generate a suggestion for. Each subject names its own type.","enum":["seo-title","meta-description","product-seo-title","product-meta-description","taxonomy-seo-title","taxonomy-meta-description","product-taxonomy-seo-title","product-taxonomy-meta-description"]},"BodyParameterExternalUserId":{"type":"string","minLength":1,"example":"wp-user-42","description":"An identifier, assigned by the API consumer, for the user the request is on behalf of. It only needs to be unique and stable within the consuming site; Yoast AI treats it as an opaque string and combines it with the site to derive an anonymized internal id. Required when authenticating via the MyYoastOAuthBearer scheme; ignored on requests authenticated via legacy schemes (where the user id comes from the access token instead)."},"ConsentGrantRequest":{"type":"object","properties":{"user_id":{"$ref":"#/components/schemas/BodyParameterExternalUserId"}}}},"responses":{"200Schema":{"description":"A JSON object containing the OpenAPI Schema.","content":{"application/json":{"schema":{"type":"object"}}}},"200Ok":{"description":"The request was fulfilled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"200OkCallback":{"description":"The callback was received and the tokens are stored client-side.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeVerifier"}}}},"200PartnerObtainedToken":{"description":"The request was fulfilled.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Message"},{"$ref":"#/components/schemas/PartnerObtainedJSONWebTokens"}]}}}},"200OpenAISuggestions":{"description":"The request was fulfilled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenAISuggestions"}}}},"200OSuggestions":{"description":"The request was fulfilled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Suggestions"}}}},"200BulkSuggestions":{"description":"The request was fulfilled. Each subject has its own per-item result; inspect each item's status (a 200 envelope can still contain per-item errors).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkSuggestions"},"example":{"summary":{"total":3,"succeeded":1,"failed":2},"results":[{"id":"101","index":0,"status":"success","choices":[{"text":"Amsterdam Bagels: Fresh-Baked Daily | Bagel Shop","index":0}]},{"id":"102","index":1,"status":"error","error_code":"AI_CONTENT_FILTER","message":"Could not generate suggestions for the given subject"},{"id":"103","index":2,"status":"error","error_code":"MISSING_LICENSE","message":"Missing license for this suggestion type","missing_licenses":["Yoast WooCommerce SEO"]}],"usage":{"totalUsed":{"license":42,"user":24,"limit":100}}}}}},"200AltTextSuggestions":{"description":"The request was fulfilled. Each image has its own per-item result; inspect each item's status (a 200 envelope can still contain per-item errors). Results are returned in request order and always match the request's subject count.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AltTextSuggestions"},"example":{"summary":{"total":2,"succeeded":1,"failed":1},"results":[{"id":"11","index":0,"status":"success","choices":[{"text":"Red mesh sneaker with white sole, shown from the side","index":0}]},{"id":"12","index":1,"status":"error","error_code":"AI_CONTENT_FILTER","message":"Could not generate an alt text for the given image"}],"usage":{"totalUsed":{"license":42,"user":24,"limit":100}}}}}},"200SummarizeSuggestions":{"description":"The request was fulfilled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummarizeSuggestions"}}}},"200ContentPlannerSuggestions":{"description":"The request was fulfilled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentPlannerSuggestions"}}}},"200ContentPlannerOutline":{"description":"The request was fulfilled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentPlannerOutline"}}}},"200Usage":{"description":"The request was fulfilled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllUsageStatistics"}}}},"400BadRequest":{"description":"The request was invalid. The body is either a `ValidationError`, when the request failed validation against this specification (malformed JSON, missing or invalid fields, unknown query parameters), or a `CodedMessage`, an operation-specific failure identified by its `error_code`.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationError","title":"Validation error","description":"The request failed validation against this specification; `errors` lists the offending fields."},{"$ref":"#/components/schemas/CodedMessage","title":"Operation failure","description":"An operation-specific failure, identified by `error_code`."}]}}}},"401UnauthorizedCallback":{"description":"The callback was rejected, possibly due to a mismatched `code_verifier` and `code_challenge`."},"401UnauthorizedLegacy":{"description":"Authentication credentials were missing or incorrect. Returned by operations that only work with Yoast-AI-minted JWTs; no `WWW-Authenticate` challenge is emitted on this path.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Message"},{"$ref":"#/components/schemas/ConnectionStatus"}]}}}},"401UnauthorizedDual":{"description":"Authentication failed for every accepted scheme. Emitted when the request carried no credentials at all, a missing, invalid, or expired legacy Yoast JWT, or a missing, invalid, or expired MyYoast OAuth access token (including a rejected or replayed DPoP proof). The body shape is identical in all cases; the `message` reflects the legacy scheme's rejection, while the `WWW-Authenticate` header describes the OAuth scheme's.","headers":{"WWW-Authenticate":{"description":"RFC 6750 / RFC 9449 challenge(s) for the MyYoast OAuth scheme, e.g. `Bearer realm=\"api\", error=\"invalid_token\", error_description=\"...\"` and/or a `DPoP` challenge listing the supported proof algorithms.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Message"},{"$ref":"#/components/schemas/ConnectionStatus"}]}}}},"402PaymentRequired":{"description":"The request can not be served, as the payment is required to proceed.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Message"},{"$ref":"#/components/schemas/MissingLicenses"}]}}}},"403Forbidden":{"description":"The request is understood, but it has been refused or access is not allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403DomainMismatch":{"description":"The `callback_url` domain does not match a domain the Yoast SEO Premium subscription is registered for, so it cannot be verified that the tokens will be sent to the licensed site.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"403ConsentRevoked":{"description":"The request was refused: either the user has revoked their consent for AI usage, or the OAuth access token does not carry the scope the operation requires. The two are distinguishable by the `WWW-Authenticate` challenge, which is present only in the insufficient-scope case.","headers":{"WWW-Authenticate":{"description":"Present only when the 403 was caused by insufficient OAuth scope (RFC 6750 § 3.1), not by revoked consent. Names the missing scope(s), e.g. `Bearer realm=\"api\", error=\"insufficient_scope\", error_description=\"...\", scope=\"service:ai:consume\"`.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Message","title":"Consent revoked","description":"The user has revoked their consent for AI usage. Have the user grant consent again to restore access. No `WWW-Authenticate` header is present in this case."},{"$ref":"#/components/schemas/Message","title":"Insufficient OAuth scope","description":"The MyYoast OAuth access token does not carry the scope(s) this operation requires. Identified by the `WWW-Authenticate` challenge with `error=\"insufficient_scope\"`."}]}}}},"403InsufficientScope":{"description":"The MyYoast OAuth access token authenticated successfully but does not carry the scope(s) this operation requires (RFC 6750 § 3.1, `insufficient_scope`). Only emitted on the OAuth path; legacy Yoast JWTs carry no scopes.","headers":{"WWW-Authenticate":{"description":"RFC 6750 § 3.1 challenge naming the missing scope(s), e.g. `Bearer realm=\"api\", error=\"insufficient_scope\", error_description=\"...\", scope=\"service:ai:consume\"`.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"404NotFound":{"description":"The requested path does not exist in this specification, or the requested resource could not be found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"408RequestTimeout":{"description":"The request timed out before it could be completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"429TooManyRequests":{"description":"The request was rate limited: too many requests were made in a given amount of time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"429TooManyRequestsAI":{"description":"The request was rate limited or a usage allowance was exhausted. The body is either a generic `Message`, when a request rate limit was exceeded, or a `FreeUsageLimit`, when the site's free AI usage allowance was exhausted.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Message","title":"Rate limited","description":"Too many requests were made in a given amount of time; carries an `error_code` when the limit was enforced by this API rather than the edge proxy."},{"$ref":"#/components/schemas/FreeUsageLimit","title":"Free usage exhausted","description":"The site has used up its free AI usage allowance (`error_code: USAGE_LIMIT_REACHED`); `missing_licenses` lists the products that would lift the limit."}]}}}},"498TokenInvalid":{"description":"The provided Yoast AI access token was invalid or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"500InternalServerError":{"description":"An unexpected error occurred while handling the request. Also emitted when the server produces a response that fails validation against this specification.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}},"503ServiceUnavailable":{"description":"A required upstream service failed or was unavailable. Try again later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Message"}}}}},"securitySchemes":{"JWTAccessTokenBearer":{"type":"apiKey","in":"header","name":"Authorization","description":"Yoast-AI-minted access JWT, presented as `Authorization: Bearer <token>`. Verified by the `access_jwt` Passport strategy. Declared as `apiKey` rather than `http`/`bearer` for parity with `MyYoastOAuthBearer`: the validator's built-in bearer pre-check would otherwise reject any non-`Bearer` Authorization header on the *same operation* before the OAuth handler had a chance, producing a misleading 401 message on DPoP requests to dual-scheme endpoints. See docs/auth.md."},"JWTRefreshTokenBearer":{"type":"apiKey","in":"header","name":"Authorization","description":"Yoast-AI-minted refresh JWT, presented as `Authorization: Bearer <token>`. Verified by the `refresh_jwt` Passport strategy. `apiKey` for the same reason as the access-token scheme (see docs/auth.md)."},"JWTPartnerTokenBearer":{"type":"apiKey","in":"header","name":"Authorization","description":"Partner-minted JWT, presented as `Authorization: Bearer <token>`. The partner is identified by the `iss` claim and verified against the partner-specific secret in `getPartnerForToken`. `apiKey` for the same reason as the access-token scheme (see docs/auth.md)."},"MyYoastOAuthBearer":{"type":"apiKey","in":"header","name":"Authorization","description":"MyYoast OAuth 2.0 access token (RFC 9068, EdDSA-signed). The Authorization Server decides whether to issue a Bearer or DPoP-bound token; both presentations are accepted here:  - Plain Bearer (token has no `cnf.jkt`):\n    `Authorization: Bearer <token>`, no DPoP header.\n  - DPoP-bound (token has `cnf.jkt`):\n    `Authorization: DPoP <token>` plus a `DPoP` proof header\n    (see the `DPoPHeader` parameter). The proof is validated\n    against `cnf.jkt`; replays are blocked via a `jti` cache.\nDeclared as `apiKey` rather than `http`/`bearer` because OpenAPI 3.0's `http`/`bearer` scheme cannot express the alternative `Authorization` scheme name `DPoP`, and express-openapi-validator's bearer pre-check would reject any non-`Bearer` value before our handler runs. See docs/auth.md."}}}}