Skip to content

Conversation

@MohamedEmadFahmy
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a new bulk endpoint for creating multiple status page subscribers in a single API request. The endpoint supports partial success scenarios where some subscribers may be created successfully while others fail.

Changes:

  • Added new /v1/{page_id}/subscribers/bulk POST endpoint that accepts up to 100 subscribers per request
  • Implemented four new schemas: BulkAddSubscribersRequest, BulkAddSubscribersResponse, BulkCreatedSubscriber, and BulkFailedSubscriber to support bulk operations
  • Added support for partial success with detailed results for both successful and failed subscriber creations

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 12 comments.

File Description
instatus.yaml Added bulk subscriber endpoint definition and associated request/response schemas
instatus.json JSON representation of the same endpoint and schema definitions for consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4354 to +4355
email to confirm their subscription. Applies to all subscribers in
the batch. This is a paid feature.
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The autoConfirm property at the bulk request level creates ambiguity with the autoConfirm property that already exists in AddSubscriberRequest. If a subscriber in the array has autoConfirm: false but the bulk request has autoConfirm: true, it's unclear which takes precedence. Consider either removing the bulk-level autoConfirm and relying on the individual subscriber settings, or documenting that the bulk-level setting overrides individual settings.

Suggested change
email to confirm their subscription. Applies to all subscribers in
the batch. This is a paid feature.
email to confirm their subscription. When this field is provided
at the bulk request level, it applies to all subscribers in the
batch and overrides any `autoConfirm` value specified on individual
subscriber objects. If omitted, the `autoConfirm` setting of each
`AddSubscriberRequest` is used. This is a paid feature.

Copilot uses AI. Check for mistakes.
content:
application/json:
schema:
$ref: "#/components/schemas/BulkAddSubscribersResponse"
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The endpoint only defines a 200 response but doesn't include error responses for common failure scenarios. Consider adding response definitions for 400 (bad request, e.g., invalid payload or exceeds 100 limit), 401 (unauthorized), and 404 (page not found) to properly document the API behavior.

Suggested change
$ref: "#/components/schemas/BulkAddSubscribersResponse"
$ref: "#/components/schemas/BulkAddSubscribersResponse"
"400":
description: Bad request - invalid payload or exceeded maximum of 100 subscribers per request
"401":
description: Unauthorized - missing or invalid authentication credentials
"404":
description: Not found - the specified status page does not exist

Copilot uses AI. Check for mistakes.
type: integer
description: The index of the subscriber in the original request array.
subscriber:
type: object
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subscriber field is defined as a generic object without a schema reference. This makes it unclear what structure will be returned. Consider using $ref: "#/components/schemas/AddSubscriberRequest" or defining the specific properties to provide clear API documentation.

Suggested change
type: object
$ref: "#/components/schemas/AddSubscriberRequest"

Copilot uses AI. Check for mistakes.
Comment on lines +5958 to +5990
"BulkCreatedSubscriber": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"email": {
"type": "string",
"nullable": true
},
"phone": {
"type": "string",
"nullable": true
},
"name": {
"type": "string",
"nullable": true
},
"confirmed": {
"type": "boolean"
},
"all": {
"type": "boolean"
},
"site": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
}
}
}
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BulkCreatedSubscriber schema is missing several fields that are present in SubscriberDetail, such as components, webhook, webhookEmail, language, and other integration fields. This inconsistency could be confusing for API consumers who expect similar data between single and bulk creation responses. Consider either including these fields or documenting why they are intentionally omitted in the bulk response.

Copilot uses AI. Check for mistakes.
properties:
subscribers:
type: array
description: Array of subscriber objects to create.
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subscribers array should have a minItems: 1 constraint. Allowing an empty array would make the request meaningless and could cause unexpected behavior. Add a minimum constraint to ensure at least one subscriber is provided.

Suggested change
description: Array of subscriber objects to create.
description: Array of subscriber objects to create.
minItems: 1

Copilot uses AI. Check for mistakes.
},
"autoConfirm": {
"type": "boolean",
"description": "Whether subscribers are automatically confirmed or will receive an email to confirm their subscription. Applies to all subscribers in the batch. This is a paid feature."
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The autoConfirm property at the bulk request level creates ambiguity with the autoConfirm property that already exists in AddSubscriberRequest. If a subscriber in the array has autoConfirm: false but the bulk request has autoConfirm: true, it's unclear which takes precedence. Consider either removing the bulk-level autoConfirm and relying on the individual subscriber settings, or documenting that the bulk-level setting overrides individual settings.

Suggested change
"description": "Whether subscribers are automatically confirmed or will receive an email to confirm their subscription. Applies to all subscribers in the batch. This is a paid feature."
"description": "Whether subscribers are automatically confirmed or will receive an email to confirm their subscription. When this field is provided at the bulk request level, it applies to all subscribers in the batch and overrides any `autoConfirm` value specified on individual subscribers. This is a paid feature."

Copilot uses AI. Check for mistakes.
"subscribers": {
"type": "array",
"description": "Array of subscriber objects to create.",
"maxItems": 100,
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subscribers array should have a minItems: 1 constraint. Allowing an empty array would make the request meaningless and could cause unexpected behavior. Add a minimum constraint to ensure at least one subscriber is provided.

Suggested change
"maxItems": 100,
"maxItems": 100,
"minItems": 1,

Copilot uses AI. Check for mistakes.
"$ref": "#/components/schemas/BulkAddSubscribersResponse"
}
}
}
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The endpoint only defines a 200 response but doesn't include error responses for common failure scenarios. Consider adding response definitions for 400 (bad request, e.g., invalid payload or exceeds 100 limit), 401 (unauthorized), and 404 (page not found) to properly document the API behavior.

Suggested change
}
}
},
"400": {
"description": "Bad request - invalid payload or exceeds 100 subscribers per request limit",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "Error code identifying the type of validation error"
},
"message": {
"type": "string",
"description": "Human-readable description of the error"
}
},
"required": ["message"]
}
}
}
},
"401": {
"description": "Unauthorized - missing or invalid API token",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "Error code indicating authentication failure"
},
"message": {
"type": "string",
"description": "Human-readable description of the authentication error"
}
},
"required": ["message"]
}
}
}
},
"404": {
"description": "Not found - the specified status page does not exist",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "Error code indicating the resource was not found"
},
"message": {
"type": "string",
"description": "Human-readable description of the not found error"
}
},
"required": ["message"]
}
}
}

Copilot uses AI. Check for mistakes.
Comment on lines +6000 to +6001
"type": "object",
"description": "The subscriber data that was submitted."
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subscriber field is defined as a generic object without a schema reference. This makes it unclear what structure will be returned. Consider using $ref: "#/components/schemas/AddSubscriberRequest" or defining the specific properties to provide clear API documentation.

Suggested change
"type": "object",
"description": "The subscriber data that was submitted."
"description": "The subscriber data that was submitted.",
"allOf": [
{
"$ref": "#/components/schemas/AddSubscriberRequest"
}
]

Copilot uses AI. Check for mistakes.
"type": "string",
"description": "Human-readable error message."
}
}
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error object properties should be marked as required to ensure consistent error reporting. Both code and message are essential for proper error handling and should not be optional.

Suggested change
}
},
"required": [
"code",
"message"
]

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants