openapi: 3.2.0 info: title: Relay External REST Deals 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: Deals paths: /deals: get: summary: List deals tags: - Deals parameters: - name: status in: query schema: type: string enum: - open - won - lost - all - name: pipeline_id in: query schema: type: string format: uuid - name: stage_id in: query schema: type: string format: uuid - name: customer_id in: query schema: type: string format: uuid - name: owner_id in: query schema: type: string format: uuid - name: search in: query schema: type: string - 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/Deal' 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: getDeals x-operation-id-source: derived post: summary: Create deal tags: - Deals requestBody: required: true description: pipeline_id, stage_id, name (required); amount, currency, expected_close_date, customer_id, owner_id, priority, notes, tags content: application/json: schema: type: object additionalProperties: true responses: '201': description: Created content: application/json: schema: type: object properties: data: $ref: '#/components/schemas/Deal' 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: postDeals x-operation-id-source: derived /deals/{id}: get: summary: Get deal tags: - Deals 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/Deal' 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: getDealsById x-operation-id-source: derived patch: summary: Update deal tags: - Deals parameters: - name: id in: path required: true schema: type: string format: uuid requestBody: required: true description: Any deal field incl. stage_id, status (won/lost stamp close time) content: application/json: schema: type: object additionalProperties: true responses: '200': description: Success content: application/json: schema: type: object properties: data: $ref: '#/components/schemas/Deal' 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: patchDealsById x-operation-id-source: derived delete: summary: Delete deal (soft) tags: - Deals 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: deleteDealsById 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' Deal: type: object properties: id: type: string organization_id: type: string pipeline_id: type: string stage_id: type: string name: type: string amount: type: - number - 'null' currency: type: string status: type: string enum: - open - won - lost priority: type: string enum: - low - medium - high - urgent customer_id: type: - string - 'null' owner_id: type: - string - 'null' position: type: integer created_at: type: string format: date-time securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: API Key