> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Send opt-in

POST https://api-sandbox.payabli.com/api/Customer/{customerId}/consent

Sends the consent opt-in email to the customer email address in the customer record.

Reference: https://docs.payabli.com/developers/api-reference/customer/customer-consent

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: payabliApi
  version: 1.0.0
paths:
  /Customer/{customerId}/consent:
    post:
      operationId: request-consent
      summary: Request consent opt-in
      description: >-
        Sends the consent opt-in email to the customer email address in the
        customer record.
      tags:
        - subpackage_customer
      parameters:
        - name: customerId
          in: path
          description: >-
            Payabli-generated customer ID. Maps to "Customer ID" column in
            PartnerHub. 
          required: true
          schema:
            type: integer
        - name: requestToken
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/type_:PayabliApiResponse00Responsedatanonobject
        '400':
          description: Bad request/ invalid data
          content:
            application/json:
              schema:
                description: Any type
        '401':
          description: Unauthorized request.
          content:
            application/json:
              schema:
                description: Any type
        '500':
          description: Internal API Error
          content:
            application/json:
              schema:
                description: Any type
        '503':
          description: Database connection error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/type_:PayabliApiResponse'
servers:
  - url: https://api-sandbox.payabli.com/api
  - url: https://api.payabli.com/api
components:
  schemas:
    type_:Responsecode:
      type: integer
      description: >-
        Code for the response. Learn more in [API Response
        Codes](/developers/api-reference/api-responses).
      title: Responsecode
    type_:PageIdentifier:
      type: string
      description: Auxiliary validation used internally by payment pages and components.
      title: PageIdentifier
    type_:IsSuccess:
      type: boolean
      description: >-
        Boolean indicating whether the operation was successful. A `true` value
        indicates success. A `false` value indicates failure.
      title: IsSuccess
    type_:ResponseText:
      type: string
      description: 'Response text for operation: ''Success'' or ''Declined''.'
      title: ResponseText
    type_:Responsedatanonobject:
      oneOf:
        - type: string
        - type: integer
      description: The response data.
      title: Responsedatanonobject
    type_:PayabliApiResponse00Responsedatanonobject:
      type: object
      properties:
        responseCode:
          $ref: '#/components/schemas/type_:Responsecode'
        pageIdentifier:
          $ref: '#/components/schemas/type_:PageIdentifier'
        roomId:
          type: integer
          format: int64
          description: >-
            Describes the room ID. Only in use on Boarding endpoints, returns
            `0` when not applicable.
        isSuccess:
          $ref: '#/components/schemas/type_:IsSuccess'
        responseText:
          $ref: '#/components/schemas/type_:ResponseText'
        responseData:
          $ref: '#/components/schemas/type_:Responsedatanonobject'
      required:
        - responseText
      title: PayabliApiResponse00Responsedatanonobject
    type_:Responsedata:
      type: object
      additionalProperties:
        description: Any type
      description: The object containing the response data.
      title: Responsedata
    type_:PayabliApiResponse:
      type: object
      properties:
        isSuccess:
          $ref: '#/components/schemas/type_:IsSuccess'
        responseData:
          $ref: '#/components/schemas/type_:Responsedata'
        responseText:
          $ref: '#/components/schemas/type_:ResponseText'
      required:
        - responseText
      title: PayabliApiResponse
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: requestToken

```

## SDK Code Examples

```typescript Success example
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.customer.requestConsent(998);
}
main();

```

```python Success example
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.customer.request_consent(
    customer_id=998,
)

```

```java Success example
package com.example.usage;

import io.github.payabli.api.PayabliPayabliApiClient;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiClient client = PayabliPayabliApiClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.customer().requestConsent(998);
    }
}
```

```ruby Success example
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.customer.request_consent(customer_id: 998)

```

```csharp Success example
using PayabliPayabliApi;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.Customer.RequestConsentAsync(
            998
        );
    }

}

```

```go Success example
package example

import (
    context "context"

    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    client.Customer.RequestConsent(
        context.TODO(),
        998,
    )
}

```

```php Success example
<?php

namespace Example;

use Payabli\PayabliClient;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->customer->requestConsent(
    998,
);

```

```swift Success example
import Foundation

let headers = ["requestToken": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/Customer/998/consent")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```