openapi: 3.2.0 info: title: Relay External REST Sequences API version: 1.1.0 description: REST API for programmatic access to Relay CRM resources. servers: - url: https://your-domain.com/api/v1 description: Production security: - bearerAuth: [] tags: - name: Sequences paths: /sequences: get: summary: List sequences tags: - Sequences parameters: - name: status in: query schema: type: string enum: - draft - active - paused - archived - name: limit in: query description: Max results (default 50). schema: type: integer minimum: 1 maximum: 100 - name: offset in: query description: Pagination offset (default 0). schema: type: integer minimum: 0 responses: '200': description: Success content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/Sequence' meta: $ref: '#/components/schemas/PaginationMeta' required: - data '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' operationId: getSequences x-operation-id-source: derived post: summary: Create sequence tags: - Sequences requestBody: required: true description: name (required), description, trigger_type, trigger_config, exit_conditions, from_email, from_name, reply_to_email content: application/json: schema: type: object additionalProperties: true responses: '201': description: Created content: application/json: schema: type: object properties: data: $ref: '#/components/schemas/Sequence' required: - data '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' operationId: postSequences x-operation-id-source: derived /sequences/{id}: get: summary: Get sequence (with steps) tags: - Sequences parameters: - name: id in: path required: true schema: type: string format: uuid responses: '200': description: Success content: application/json: schema: type: object properties: data: $ref: '#/components/schemas/Sequence' required: - data '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' operationId: getSequencesById x-operation-id-source: derived patch: summary: Update sequence tags: - Sequences parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true description: Any of name, description, trigger_type, trigger_config, exit_conditions, from_email, from_name, reply_to_email, status. Setting status=active requires >=1 step. content: application/json: schema: type: object additionalProperties: true responses: '200': description: Success content: application/json: schema: type: object properties: data: $ref: '#/components/schemas/Sequence' required: - data '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' operationId: patchSequencesById x-operation-id-source: derived delete: summary: Delete sequence tags: - Sequences parameters: - name: id in: path required: true schema: type: string format: uuid responses: '204': description: No content '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' operationId: deleteSequencesById x-operation-id-source: derived /sequences/{id}/enroll: post: summary: Enroll a contact tags: - Sequences parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true description: customer_id OR email (required); enrollment_source, enrollment_data optional content: application/json: schema: type: object additionalProperties: true responses: '201': description: Enrolled content: application/json: schema: type: object properties: data: $ref: '#/components/schemas/SequenceEnrollment' required: - data '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden — missing sequences:write scope content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Sequence or contact not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '409': description: Contact already enrolled in this sequence content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '422': description: Contact ineligible for outreach (see error.details.reason) content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' operationId: postSequencesByIdEnroll x-operation-id-source: derived /sequences/{id}/enroll_bulk: post: summary: Bulk-enroll contacts tags: - Sequences parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true description: customer_ids and/or emails (<=1000 total); enrollment_source optional content: application/json: schema: type: object additionalProperties: true responses: '200': description: Success content: application/json: schema: type: object properties: data: type: object properties: enrolled: type: integer skipped: type: integer results: type: array items: type: object '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' operationId: postSequencesByIdEnrollBulk x-operation-id-source: derived /sequences/{id}/enrollments: get: summary: List enrollments tags: - Sequences parameters: - name: id in: path required: true schema: type: string format: uuid - name: status in: query schema: type: string enum: - active - paused - completed - exited - failed - name: limit in: query description: Max results (default 50). schema: type: integer minimum: 1 maximum: 100 - name: offset in: query description: Pagination offset (default 0). schema: type: integer minimum: 0 responses: '200': description: Success content: application/json: schema: type: object properties: data: type: array items: $ref: '#/components/schemas/SequenceEnrollment' meta: $ref: '#/components/schemas/PaginationMeta' required: - data '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' operationId: getSequencesByIdEnrollments x-operation-id-source: derived /sequences/{id}/enrollments/{enrollmentId}: patch: summary: Pause/resume enrollment tags: - Sequences parameters: - name: id in: path required: true schema: type: string format: uuid - name: enrollmentId in: path required: true schema: type: string format: uuid requestBody: required: true description: 'status: "paused" or "active"' content: application/json: schema: type: object additionalProperties: true responses: '200': description: Success content: application/json: schema: type: object properties: data: $ref: '#/components/schemas/SequenceEnrollment' required: - data '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' operationId: patchSequencesByIdEnrollmentsByEnrollmentId x-operation-id-source: derived delete: summary: Unenroll (exit) tags: - Sequences parameters: - name: id in: path required: true schema: type: string format: uuid - name: enrollmentId in: path required: true schema: type: string format: uuid - name: reason in: query description: Exit reason (default manual). schema: type: string enum: - replied - converted - unsubscribed - manual - bounced responses: '200': description: Success content: application/json: schema: type: object properties: data: type: object properties: success: type: boolean status: type: string exit_reason: type: string '400': description: Bad request content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '403': description: Forbidden content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' operationId: deleteSequencesByIdEnrollmentsByEnrollmentId x-operation-id-source: derived components: schemas: ErrorResponse: type: object properties: error: type: object properties: code: type: string message: type: string details: {} required: - code - message required: - error PaginationMeta: type: object properties: total: type: integer limit: type: integer next_cursor: type: - string - 'null' Sequence: type: object properties: id: type: string organization_id: type: string name: type: string description: type: - string - 'null' trigger_type: type: string enum: - manual - webhook - form_submission - tag_added - contact_created status: type: string enum: - draft - active - paused - archived from_email: type: - string - 'null' from_name: type: - string - 'null' reply_to_email: type: - string - 'null' total_enrolled: type: integer total_completed: type: integer total_unsubscribed: type: integer created_at: type: string format: date-time SequenceEnrollment: type: object properties: id: type: string sequence_id: type: string customer_id: type: string organization_id: type: string status: type: string enum: - active - paused - completed - exited - failed current_step_position: type: integer next_send_at: type: - string - 'null' format: date-time enrollment_source: type: string enrolled_at: type: string format: date-time securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: API Key