# Transfer points to another profile

- Operation ID: `PointsTransfer`
- HTTP method: `POST`
- Path: `/v4/promotions/v2/points/transfer`
- [Human-readable API reference](https://hub.synerise.com/api-reference/loyalty-and-engagement#tag/Promotions-points/operation/PointsTransfer)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /v4/promotions/v2/points/transfer:
    post:
      tags:
        - Promotions points
      summary: Transfer points to another profile
      description: |
        With this method, a profile can send some of their points to another profile.

        ---

        **API consumers:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=authenticateUsingPOST_v3" target="_blank" rel="noopener">Profile (Client)</a>, <a href="/api-reference/authorization?tag=Authorization&amp;operationId=LogInAnonymouslyV3" target="_blank" rel="noopener">Anonymous Profile</a>
      operationId: PointsTransfer
      security:
        - JWT: []
      requestBody:
        content:
          application/json:
            schema:
              required:
                - pointsAmount
                - recipient
              properties:
                pointsAmount:
                  type: integer
                  description: How many points to send
                  minimum: 1
                recipient:
                  type: object
                  description: Identifier of the recipient
                  required:
                    - clientKey
                    - clientKeyValue
                  properties:
                    clientKey:
                      type: string
                      example: clientId
                      description: Type of profile identifier
                      enum:
                        - externalId
                        - clientId
                        - email
                        - phone
                        - uuid
                    clientKeyValue:
                      description: Value of the selected identifier
                      type: string
                      example: "434428563"
                    name:
                      description: Name of the points recipient
                      type: string
                sender:
                  type: object
                  description: Information about the sender
                  properties:
                    name:
                      description: Name of the points sender
                      type: string
                message:
                  type: string
                  description: A message that the recipient will receive with the points
                  maxLength: 256
      responses:
        "202":
          description: Point transfer scheduled
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Point transfer scheduled
        "400":
          description: Bad request
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    description: Details of an error
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Date and time when the error occurred
                        example: 2020-10-05T10:59:21.000Z
                      traceId:
                        type: string
                        description: TraceId of the request which resulted in the error
                        example: 8705651679b203e7
                      errorCode:
                        type: string
                        description: Error code which helps identify the issue. See [API error reference](https://hub.synerise.com/api-reference/errors.html).
                        example: ERR-001
                      message:
                        type: string
                        description: Short description of the error
                        example: Internal Error
                      httpStatus:
                        type: number
                        description: HTTP status of the error
                        example: 500
                  - description: Details of a body validation error
                    properties:
                      errors:
                        type: array
                        items:
                          type: object
                          description: Details of a validation error
                          properties:
                            errorCode:
                              type: string
                              description: Short description of the error
                              example: Internal Error
                            source:
                              type: object
                              properties:
                                pointer:
                                  description: JSON pointer to the object which was source of the error
                                  example: /exampleKey
                    example:
                      errorCode: ERR-042
                      httpStatus: 400
                      message: Invalid data
                      timestamp: 2020-10-05T10:59:21.000Z
                      traceId: 8705651679b203e7
        "404":
          description: Profile not found
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    description: Details of an error
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Date and time when the error occurred
                        example: 2020-10-05T10:59:21.000Z
                      traceId:
                        type: string
                        description: TraceId of the request which resulted in the error
                        example: 8705651679b203e7
                      errorCode:
                        type: string
                        description: Error code which helps identify the issue. See [API error reference](https://hub.synerise.com/api-reference/errors.html).
                        example: ERR-001
                      message:
                        type: string
                        description: Short description of the error
                        example: Internal Error
                      httpStatus:
                        type: number
                        description: HTTP status of the error
                        example: 500
                  - description: Profile not found
                    example:
                      errorCode: CLI-001
                      httpStatus: 404
                      message: Profile not found
                      timestamp: 2020-10-05T10:59:21.000Z
                      traceId: 8705651679b203e7
        "422":
          description: Unprocessable point transfer
          content:
            application/json:
              schema:
                anyOf:
                  - allOf:
                      - type: object
                        description: Details of an error
                        properties:
                          timestamp:
                            type: string
                            format: date-time
                            description: Date and time when the error occurred
                            example: 2020-10-05T10:59:21.000Z
                          traceId:
                            type: string
                            description: TraceId of the request which resulted in the error
                            example: 8705651679b203e7
                          errorCode:
                            type: string
                            description: Error code which helps identify the issue. See [API error reference](https://hub.synerise.com/api-reference/errors.html).
                            example: ERR-001
                          message:
                            type: string
                            description: Short description of the error
                            example: Internal Error
                          httpStatus:
                            type: number
                            description: HTTP status of the error
                            example: 500
                      - description: Profile does not have the required number of points
                        example:
                          errorCode: PRO-015
                          httpStatus: 422
                          message: Profile does not have the required number of points
                          timestamp: 2020-10-05T10:59:21.000Z
                          traceId: 8705651679b203e7
                  - allOf:
                      - type: object
                        description: Details of an error
                        properties:
                          timestamp:
                            type: string
                            format: date-time
                            description: Date and time when the error occurred
                            example: 2020-10-05T10:59:21.000Z
                          traceId:
                            type: string
                            description: TraceId of the request which resulted in the error
                            example: 8705651679b203e7
                          errorCode:
                            type: string
                            description: Error code which helps identify the issue. See [API error reference](https://hub.synerise.com/api-reference/errors.html).
                            example: ERR-001
                          message:
                            type: string
                            description: Short description of the error
                            example: Internal Error
                          httpStatus:
                            type: number
                            description: HTTP status of the error
                            example: 500
                      - description: Point sender is not in the required segmentation
                        example:
                          errorCode: PRO-034
                          httpStatus: 422
                          message: Point sender is not in the required segmentation
                          timestamp: 2020-10-05T10:59:21.000Z
                          traceId: 8705651679b203e7
                  - allOf:
                      - type: object
                        description: Details of an error
                        properties:
                          timestamp:
                            type: string
                            format: date-time
                            description: Date and time when the error occurred
                            example: 2020-10-05T10:59:21.000Z
                          traceId:
                            type: string
                            description: TraceId of the request which resulted in the error
                            example: 8705651679b203e7
                          errorCode:
                            type: string
                            description: Error code which helps identify the issue. See [API error reference](https://hub.synerise.com/api-reference/errors.html).
                            example: ERR-001
                          message:
                            type: string
                            description: Short description of the error
                            example: Internal Error
                          httpStatus:
                            type: number
                            description: HTTP status of the error
                            example: 500
                      - description: Point recipient is not in required segmentation
                        example:
                          errorCode: PRO-035
                          httpStatus: 422
                          message: Point recipient is not in required segmentation
                          timestamp: 2020-10-05T10:59:21.000Z
                          traceId: 8705651679b203e7
        "423":
          description: Profile points lock error
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    description: Details of an error
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Date and time when the error occurred
                        example: 2020-10-05T10:59:21.000Z
                      traceId:
                        type: string
                        description: TraceId of the request which resulted in the error
                        example: 8705651679b203e7
                      errorCode:
                        type: string
                        description: Error code which helps identify the issue. See [API error reference](https://hub.synerise.com/api-reference/errors.html).
                        example: ERR-001
                      message:
                        type: string
                        description: Short description of the error
                        example: Internal Error
                      httpStatus:
                        type: number
                        description: HTTP status of the error
                        example: 500
                  - description: Profile points are locked. Waiting for releasing lock for the profile
                    example:
                      errorCode: PRO-016
                      httpStatus: 423
                      message: Profile points are locked. Waiting for releasing lock for the profile.
                      timestamp: 2020-10-05T10:59:21.000Z
                      traceId: 8705651679b203e7
      x-snr-doc-urls:
        - /api-reference/loyalty-and-engagement#tag/Promotions-points/operation/PointsTransfer
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/v4/promotions/v2/points/transfer \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"pointsAmount":1,"recipient":{"clientKey":"clientId","clientKeyValue":"434428563","name":"string"},"sender":{"name":"string"},"message":"string"}'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            payload = "{\"pointsAmount\":1,\"recipient\":{\"clientKey\":\"clientId\",\"clientKeyValue\":\"434428563\",\"name\":\"string\"},\"sender\":{\"name\":\"string\"},\"message\":\"string\"}"

            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
                }

            conn.request("POST", "/v4/promotions/v2/points/transfer", payload, headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "pointsAmount": 1,
              "recipient": {
                "clientKey": "clientId",
                "clientKeyValue": "434428563",
                "name": "string"
              },
              "sender": {
                "name": "string"
              },
              "message": "string"
            });

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("POST", "https://api.synerise.com/v4/promotions/v2/points/transfer");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");
            xhr.setRequestHeader("content-type", "application/json");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "POST",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/v4/promotions/v2/points/transfer",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN",
                "content-type": "application/json"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              pointsAmount: 1,
              recipient: {clientKey: 'clientId', clientKeyValue: '434428563', name: 'string'},
              sender: {name: 'string'},
              message: 'string'
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/v4/promotions/v2/points/transfer');
            $request->setMethod(HTTP_METH_POST);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN',
              'content-type' => 'application/json'
            ]);

            $request->setBody('{"pointsAmount":1,"recipient":{"clientKey":"clientId","clientKeyValue":"434428563","name":"string"},"sender":{"name":"string"},"message":"string"}');

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.post("https://api.synerise.com/v4/promotions/v2/points/transfer")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("{\"pointsAmount\":1,\"recipient\":{\"clientKey\":\"clientId\",\"clientKeyValue\":\"434428563\",\"name\":\"string\"},\"sender\":{\"name\":\"string\"},\"message\":\"string\"}")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Promotions points
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
