subscribe-newsletter
Method: POST
Path: /campaigns/newsletter-subscribe
Tags: Newsletter
Summary
Subscribe to newsletter
Description
Requires an anonymous or signed-in bearer session.
Storefront SDK Usage
SDK Method: sdk.helpers.subscribeToNewsletter()
Example:
typescript
const { data, error } = await sdk.helpers.subscribeToNewsletter({ email: "jane@example.com" });TypeScript Definition
typescript
"subscribe-newsletter": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody: {
content: {
"application/json": {
/** Format: email */
email: string;
};
};
};
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
message: string;
success: boolean;
};
};
};
400: components["responses"]["BadRequest"];
401: components["responses"]["Unauthorized"];
403: components["responses"]["Forbidden"];
500: components["responses"]["InternalServerError"];
504: components["responses"]["GatewayTimeout"];
};
}Component References
| Reference | Resolves To |
|---|---|
components["responses"]["BadRequest"] | BadRequest |
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["Forbidden"] | Forbidden |
components["responses"]["InternalServerError"] | InternalServerError |
components["responses"]["GatewayTimeout"] | GatewayTimeout |
Request Body
Content Types: application/json
Responses
200
OK
400
Bad request
401
Authentication failed. Codes include token-required, token-expired and token_not_valid for an invalid or expired token.
403
Access denied. token-required requires an authenticated session; permission-denied means the caller cannot access this resource. On POS, session-expired requires signing in again.
500
The request failed because of an unexpected error.
504
The request timed out.
OpenAPI Definition
json
{
"tags": [
"Newsletter"
],
"operationId": "subscribe-newsletter",
"summary": "Subscribe to newsletter",
"description": " Requires an anonymous or signed-in bearer session.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/subscribe-newsletter",
"description": "API reference for the subscribe-newsletter operation"
},
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"email"
],
"properties": {
"email": {
"type": "string",
"format": "email",
"maxLength": 128
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success"
],
"properties": {
"message": {
"type": "string"
},
"success": {
"type": "boolean"
}
}
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
},
"504": {
"$ref": "#/components/responses/GatewayTimeout"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "campaigns",
"x-speakeasy-ignore": true,
"x-speakeasy-name-override": "subscribeNewsletter"
}Auto-generated from OpenAPI spec and TypeScript definitions