> For the complete documentation index, see [llms.txt](https://apidocs.onekeypayments.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.onekeypayments.com/api-reference/deposits-api/automatic-pix/create-enrollment.md).

# Create enrollment

## Create Enrollment

> This endpoint will allow you to start an enrollment.

```json
{"openapi":"3.0.3","info":{"title":"OneKey Payments API","version":"1.0.0"},"servers":[{"url":"https://api-stg.onekeypayments.com/v1","description":"Staging Server"}],"paths":{"/enrollments":{"post":{"summary":"Create Enrollment","description":"This endpoint will allow you to start an enrollment.","operationId":"createEnrollment","tags":["Enrollments"],"parameters":[{"name":"Content-Type","in":"header","required":true,"schema":{"type":"string","default":"application/json"},"description":"Content type of the request."},{"name":"X-Date","in":"header","required":true,"schema":{"type":"string","format":"date-time"},"description":"ISO8601 Datetime with Timezone: yyyy-MM-dd'T'HH:mm:ssZ"},{"name":"X-Login","in":"header","required":true,"schema":{"type":"string"},"description":"Merchant X-Login API Key."},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Authorization control hash."},{"name":"X-Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Unique idempotency key."}],"requestBody":{"description":"Enrollment creation payload","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentRequest"}}}},"responses":{"200":{"description":"Enrollment created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentResponse"}}}},"400":{"description":"Bad Request - Invalid input or missing fields."},"401":{"description":"Unauthorized - Authentication headers are missing or incorrect."}}}}},"components":{"schemas":{"EnrollmentRequest":{"type":"object","description":"Payload to create a new enrollment.","required":["invoice_id","country","currency","payer","amount","success_url","notification_url","start_date","frequency","amount_type","include_first_payment"],"properties":{"invoice_id":{"type":"string","description":"Unique deposit ID on your side."},"country":{"type":"string","description":"Country of the deposit (e.g., BR)."},"currency":{"type":"string","description":"Currency of the deposit (e.g., BRL)."},"payer":{"$ref":"#/components/schemas/Payer"},"start_date":{"type":"string","format":"date","description":"Date the enrollment starts. Format YYYY-MM-DD."},"frequency":{"type":"string","description":"Frequency of the enrollment.","enum":["DAILY","WEEKLY","MONTHLY","ANNUALLY"]},"amount":{"type":"number","format":"float","description":"Amount of the deposit."},"amount_type":{"type":"string","description":"Type of amount.","enum":["FIXED"]},"include_first_payment":{"type":"boolean","description":"Indicates if a payment will be made as soon as the enrollment is created."},"success_url":{"type":"string","format":"uri","description":"HTTPS URL to redirect customer on success."},"notification_url":{"type":"string","format":"uri","description":"HTTPS URL for deposit status change notifications."}}},"Payer":{"type":"object","description":"Object containing details about the customer.","required":["first_name","last_name","document","document_type","email","phone"],"properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"document":{"type":"string"},"document_type":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"}}},"EnrollmentResponse":{"type":"object","description":"Successful enrollment creation response.","properties":{"enrollment_id":{"type":"integer","description":"The ID of the enrollment."},"invoice_id":{"type":"string","description":"ID of the deposit on the merchant end."},"country":{"type":"string"},"currency":{"type":"string"},"amount":{"type":"number","format":"float","description":"Amount of the enrollment created."},"status":{"type":"string","description":"Status of the enrollment."},"redirect_url":{"type":"string","format":"uri","description":"URL to redirect the customer to pay."},"metadata":{"$ref":"#/components/schemas/EnrollmentResponseMetadata"}}},"EnrollmentResponseMetadata":{"type":"object","description":"Metadata associated with the enrollment response, such as payment details.","properties":{"qr_code":{"type":"string","format":"byte","description":"PNG image encoded in base64 of the QR code (PIX)."},"digitable_line":{"type":"string","description":"Plain text string line for manual PIX payment."}}}}}}
```
