# 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.1 info: title: Request consent opt-in version: endpoint_customer.RequestConsent 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: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} components: schemas: type_:Responsecode: type: integer type_:PageIdentifier: type: string type_:IsSuccess: type: boolean type_:ResponseText: type: string type_:Responsedatanonobject: oneOf: - type: string - type: integer 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 ``` ## SDK Code Examples ```python Success example from payabli import payabli client = payabli( api_key="YOUR_API_KEY", ) client.customer.request_consent( customer_id=998, ) ``` ```typescript Success example import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.customer.requestConsent(998); ``` ```go Success example import ( context "context" option "github.com/payabli/sdk-go/option" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.Customer.RequestConsent( context.TODO(), 998, ) ``` ```csharp Success example using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.Customer.RequestConsentAsync(998); ``` ```ruby Success example require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/Customer/998/consent") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["requestToken"] = '' response = http.request(request) puts response.read_body ``` ```java Success example HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/Customer/998/consent") .header("requestToken", "") .asString(); ``` ```php Success example request('POST', 'https://api-sandbox.payabli.com/api/Customer/998/consent', [ 'headers' => [ 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift Success example import Foundation let headers = ["requestToken": ""] 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() ```