# Delete a beneficiary

> Delete a beneficiary belonging to the operating merchant and return its identifier with status deleted.

```yaml
openapi: 3.1.0
x-onerway-docs-version: original
x-onerway-spec-key: transfer/v3-beneficiaries/remove
info:
  title: Delete a beneficiary
  version: original
  description: Delete a beneficiary belonging to the operating merchant and return
    its identifier with status deleted.
servers:
  - url: https://sandbox-transfer-api.onerway.com
    description: sandbox
  - url: https://transfer-api.onerway.com
    description: production
paths:
  /api/v3/beneficiary/remove:
    post:
      summary: Delete a beneficiary
      description: Delete a beneficiary belonging to the operating merchant and return
        its identifier with status deleted.
      parameters:
        - name: ApiKey
          in: header
          required: true
          description: Account service API key assigned by Onerway, supplied in the
            request header. Use the key for the same environment as the request
            domain.
          schema:
            type: string
            description: Account service API key assigned by Onerway, supplied in the
              request header. Use the key for the same environment as the
              request domain.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                beneficiaryId:
                  type: integer
                  description: Onerway beneficiary ID (64-bit integer).
                  x-onerway-constraints:
                    - kind: rule
                      text: beneficiaryId is required and must exist, belong to the operating merchant
                        and not already be deleted. Repeated deletion is not
                        guaranteed to succeed idempotently.
                    - kind: rule
                      text: Cannot delete a beneficiary with payments in A (created) or P
                        (processing). Complete those payments first.
                onBehalfOf:
                  type: string
                  description: Merchant number that the request applies to. Supply it only when
                    making a request on behalf of another merchant.
              required:
                - beneficiaryId
            examples:
              default:
                summary: Request structure (replace with your merchant data)
                value:
                  beneficiaryId: 10001
      responses:
        "200":
          description: Success example
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      respCode:
                        type: string
                        description: Response code; `20000` indicates successful request processing. All
                          other values are error codes.
                      respMsg:
                        type: string
                        description: Human-readable description of the response code.
                      data:
                        type: object
                        properties:
                          beneficiaryId:
                            type: string
                            description: Onerway beneficiary ID.
                          status:
                            type: string
                            description: Beneficiary status. See [beneficiary
                              statuses](/transfer/api-reference/v3-enums#beneficiarystatus-beneficiary-statuses).
                            enum:
                              - deleted
                            x-enum-descriptions:
                              deleted: Deleted
                        description: Business data on success; do not consume as valid business data on
                          failure
                        x-onerway-constraints:
                          - kind: rule
                            text: A successful result returns status=deleted. A deleted beneficiary cannot
                              subsequently be retrieved or edited as an active
                              record. Deleting it does not cancel historical
                              transfers.
                      error:
                        type: object
                        properties:
                          type:
                            type: string
                            description: Error type.
                          code:
                            type: string
                            description: Endpoint error identifier.
                          declineCode:
                            type: string
                            description: Decline reason code; may be empty.
                          message:
                            type: string
                            description: Detailed error description
                          param:
                            type: string
                            description: Failed field or condition; may be empty when no field is identified
                          docUrl:
                            type: string
                            description: Link to error documentation; may be empty.
                          requestId:
                            type: string
                            description: Server-generated error trace identifier, req_ plus 32 hexadecimal
                              characters; not the merchant requestId
                          errorDetails:
                            type: array
                            description: Error details; see the variants below
                            items:
                              type: object
                              properties:
                                errorCode:
                                  type: string
                                  description: Business or validation detail code.
                                message:
                                  type: string
                                  description: Detail message
                        description: Structured failure information; not present for every failure path
                  - type: object
                    properties:
                      respCode:
                        type: string
                      respMsg:
                        type: string
                      error:
                        type: object
                        properties:
                          type:
                            type: string
                          code:
                            type: string
                          message:
                            type: string
                          requestId:
                            type: string
                          errorDetails:
                            type: array
                            items:
                              type: object
                              properties:
                                errorCode:
                                  type: string
                                message:
                                  type: string
                              required:
                                - errorCode
                                - message
                        required:
                          - type
                          - code
                          - message
                          - requestId
                          - errorDetails
                    required:
                      - respCode
                      - respMsg
                      - error
              examples:
                "50112":
                  summary: The identifier is nonexistent, foreign-owned or already deleted.
                  description: The identifier is nonexistent, foreign-owned or already deleted.
                  value:
                    respCode: "50112"
                    respMsg: beneficiaryId invalid
                    error:
                      type: business_error
                      code: cl1048
                      message: beneficiaryId invalid
                      requestId: req_00000000000000000000000000000001
                      errorDetails:
                        - errorCode: cl1048
                          message: beneficiaryId invalid
                success:
                  summary: Success example
                  value:
                    respCode: "20000"
                    respMsg: Success
                    data:
                      beneficiaryId: "10001"
                      status: deleted
                failure:
                  summary: The identifier is nonexistent, foreign-owned or already deleted.
                  value:
                    respCode: "50112"
                    respMsg: beneficiaryId invalid
                    error:
                      type: business_error
                      code: cl1048
                      message: beneficiaryId invalid
                      requestId: req_00000000000000000000000000000001
                      errorDetails:
                        - errorCode: cl1048
                          message: beneficiaryId invalid
```
