For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.ivfprovider.com/ivf-agency-ap-is/sperm-donor/llms.txt. For full documentation content, see https://docs.ivfprovider.com/ivf-agency-ap-is/sperm-donor/llms-full.txt.

# Create

POST http://localhost:8000/api/sperm-donors
Content-Type: application/json

Reference: https://docs.ivfprovider.com/ivf-agency-ap-is/sperm-donor/create

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/sperm-donors:
    post:
      operationId: create
      summary: Create
      tags:
        - subpackage_spermDonor
      parameters:
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sperm Donor_Create_Response_200'
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiSperm-donorsRequestUnprocessableEntityError
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                user:
                  $ref: >-
                    #/components/schemas/ApiSpermDonorsPostRequestBodyContentApplicationJsonSchemaUser
                user_profile:
                  $ref: >-
                    #/components/schemas/ApiSpermDonorsPostRequestBodyContentApplicationJsonSchemaUserProfile
                account_activation_email:
                  type: boolean
              required:
                - user
                - user_profile
                - account_activation_email
servers:
  - url: http://localhost:8000
components:
  schemas:
    ApiSpermDonorsPostRequestBodyContentApplicationJsonSchemaUser:
      type: object
      properties:
        first_name:
          type: string
        last_name:
          type: string
        agency_id:
          description: Any type
        is_private_donor:
          type: string
        has_contact_details:
          type: string
        email:
          type: string
          format: email
      required:
        - first_name
        - last_name
        - is_private_donor
        - has_contact_details
        - email
      title: ApiSpermDonorsPostRequestBodyContentApplicationJsonSchemaUser
    ApiSpermDonorsPostRequestBodyContentApplicationJsonSchemaUserProfile:
      type: object
      properties:
        date_of_birth:
          type: string
          format: date
        home_phone:
          type: string
        home_phone_country:
          type: string
        mobile_phone:
          type: string
        mobile_phone_country:
          type: string
      required:
        - date_of_birth
        - home_phone
        - home_phone_country
        - mobile_phone
        - mobile_phone_country
      title: ApiSpermDonorsPostRequestBodyContentApplicationJsonSchemaUserProfile
    ApiSpermDonorsPostResponsesContentApplicationJsonSchemaUserRolesItemsPivot:
      type: object
      properties:
        user_id:
          type: integer
        role_id:
          type: integer
      required:
        - user_id
        - role_id
      title: >-
        ApiSpermDonorsPostResponsesContentApplicationJsonSchemaUserRolesItemsPivot
    ApiSpermDonorsPostResponsesContentApplicationJsonSchemaUserRolesItems:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        alias:
          type: string
        is_admin:
          type: boolean
        is_default:
          type: boolean
        pivot:
          $ref: >-
            #/components/schemas/ApiSpermDonorsPostResponsesContentApplicationJsonSchemaUserRolesItemsPivot
      required:
        - id
        - name
        - alias
        - is_admin
        - is_default
        - pivot
      title: ApiSpermDonorsPostResponsesContentApplicationJsonSchemaUserRolesItems
    ApiSpermDonorsPostResponsesContentApplicationJsonSchemaUser:
      type: object
      properties:
        id:
          type: integer
        agency_id:
          type: integer
        first_name:
          type: string
        last_name:
          type: string
        middle_name:
          description: Any type
        email:
          type: string
          format: email
        email_verified_at:
          description: Any type
        is_admin:
          type: boolean
        status_id:
          type: integer
        is_visible:
          type: integer
        unique_id:
          type: string
        stripe_customer_id:
          description: Any type
        is_premium:
          type: integer
        ip_whitelist_enabled:
          type: integer
        profile_percentage:
          type: integer
        login_attempt:
          type: integer
        reason:
          description: Any type
        agreement_accepted_at:
          description: Any type
        agreement_accepted_ip:
          description: Any type
        agreement_signature_path:
          description: Any type
        full_name:
          type: string
        roles:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiSpermDonorsPostResponsesContentApplicationJsonSchemaUserRolesItems
      required:
        - id
        - agency_id
        - first_name
        - last_name
        - email
        - is_admin
        - status_id
        - is_visible
        - unique_id
        - is_premium
        - ip_whitelist_enabled
        - profile_percentage
        - login_attempt
        - full_name
        - roles
      title: ApiSpermDonorsPostResponsesContentApplicationJsonSchemaUser
    Sperm Donor_Create_Response_200:
      type: object
      properties:
        status:
          type: integer
        message:
          type: string
        user:
          $ref: >-
            #/components/schemas/ApiSpermDonorsPostResponsesContentApplicationJsonSchemaUser
      required:
        - status
        - message
        - user
      title: Sperm Donor_Create_Response_200
    ApiSpermDonorsPostResponsesContentApplicationJsonSchemaErrors:
      type: object
      properties:
        user.first_name:
          type: array
          items:
            type: string
        user.last_name:
          type: array
          items:
            type: string
        user.email:
          type: array
          items:
            type: string
        user.password:
          type: array
          items:
            type: string
        user.confirm_password:
          type: array
          items:
            type: string
        user_profile.date_of_birth:
          type: array
          items:
            type: string
      required:
        - user.first_name
        - user.last_name
        - user.email
        - user.password
        - user.confirm_password
        - user_profile.date_of_birth
      title: ApiSpermDonorsPostResponsesContentApplicationJsonSchemaErrors
    PostApiSperm-donorsRequestUnprocessableEntityError:
      type: object
      properties:
        status:
          type: integer
        message:
          type: string
        errors:
          $ref: >-
            #/components/schemas/ApiSpermDonorsPostResponsesContentApplicationJsonSchemaErrors
      required:
        - status
        - message
        - errors
      title: PostApiSperm-donorsRequestUnprocessableEntityError
  securitySchemes:
    oauth2Auth:
      type: http
      scheme: bearer

```

## SDK Code Examples

```python Sperm Donor_Create_example
import requests

url = "http://localhost:8000/api/sperm-donors"

payload = {
    "user": {
        "first_name": "Agency",
        "last_name": "Sperm Donor",
        "is_private_donor": "no",
        "has_contact_details": "yes",
        "email": "agency.spermdonor@gmail.com"
    },
    "user_profile": {
        "date_of_birth": "2000-02-24",
        "home_phone": "1234567890",
        "home_phone_country": "US",
        "mobile_phone": "21123456",
        "mobile_phone_country": "US"
    },
    "account_activation_email": True
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Sperm Donor_Create_example
const url = 'http://localhost:8000/api/sperm-donors';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"user":{"first_name":"Agency","last_name":"Sperm Donor","is_private_donor":"no","has_contact_details":"yes","email":"agency.spermdonor@gmail.com"},"user_profile":{"date_of_birth":"2000-02-24","home_phone":"1234567890","home_phone_country":"US","mobile_phone":"21123456","mobile_phone_country":"US"},"account_activation_email":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Sperm Donor_Create_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8000/api/sperm-donors"

	payload := strings.NewReader("{\n  \"user\": {\n    \"first_name\": \"Agency\",\n    \"last_name\": \"Sperm Donor\",\n    \"is_private_donor\": \"no\",\n    \"has_contact_details\": \"yes\",\n    \"email\": \"agency.spermdonor@gmail.com\"\n  },\n  \"user_profile\": {\n    \"date_of_birth\": \"2000-02-24\",\n    \"home_phone\": \"1234567890\",\n    \"home_phone_country\": \"US\",\n    \"mobile_phone\": \"21123456\",\n    \"mobile_phone_country\": \"US\"\n  },\n  \"account_activation_email\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Sperm Donor_Create_example
require 'uri'
require 'net/http'

url = URI("http://localhost:8000/api/sperm-donors")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"user\": {\n    \"first_name\": \"Agency\",\n    \"last_name\": \"Sperm Donor\",\n    \"is_private_donor\": \"no\",\n    \"has_contact_details\": \"yes\",\n    \"email\": \"agency.spermdonor@gmail.com\"\n  },\n  \"user_profile\": {\n    \"date_of_birth\": \"2000-02-24\",\n    \"home_phone\": \"1234567890\",\n    \"home_phone_country\": \"US\",\n    \"mobile_phone\": \"21123456\",\n    \"mobile_phone_country\": \"US\"\n  },\n  \"account_activation_email\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Sperm Donor_Create_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://localhost:8000/api/sperm-donors")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"user\": {\n    \"first_name\": \"Agency\",\n    \"last_name\": \"Sperm Donor\",\n    \"is_private_donor\": \"no\",\n    \"has_contact_details\": \"yes\",\n    \"email\": \"agency.spermdonor@gmail.com\"\n  },\n  \"user_profile\": {\n    \"date_of_birth\": \"2000-02-24\",\n    \"home_phone\": \"1234567890\",\n    \"home_phone_country\": \"US\",\n    \"mobile_phone\": \"21123456\",\n    \"mobile_phone_country\": \"US\"\n  },\n  \"account_activation_email\": true\n}")
  .asString();
```

```php Sperm Donor_Create_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:8000/api/sperm-donors', [
  'body' => '{
  "user": {
    "first_name": "Agency",
    "last_name": "Sperm Donor",
    "is_private_donor": "no",
    "has_contact_details": "yes",
    "email": "agency.spermdonor@gmail.com"
  },
  "user_profile": {
    "date_of_birth": "2000-02-24",
    "home_phone": "1234567890",
    "home_phone_country": "US",
    "mobile_phone": "21123456",
    "mobile_phone_country": "US"
  },
  "account_activation_email": true
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Sperm Donor_Create_example
using RestSharp;

var client = new RestClient("http://localhost:8000/api/sperm-donors");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"user\": {\n    \"first_name\": \"Agency\",\n    \"last_name\": \"Sperm Donor\",\n    \"is_private_donor\": \"no\",\n    \"has_contact_details\": \"yes\",\n    \"email\": \"agency.spermdonor@gmail.com\"\n  },\n  \"user_profile\": {\n    \"date_of_birth\": \"2000-02-24\",\n    \"home_phone\": \"1234567890\",\n    \"home_phone_country\": \"US\",\n    \"mobile_phone\": \"21123456\",\n    \"mobile_phone_country\": \"US\"\n  },\n  \"account_activation_email\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Sperm Donor_Create_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "user": [
    "first_name": "Agency",
    "last_name": "Sperm Donor",
    "is_private_donor": "no",
    "has_contact_details": "yes",
    "email": "agency.spermdonor@gmail.com"
  ],
  "user_profile": [
    "date_of_birth": "2000-02-24",
    "home_phone": "1234567890",
    "home_phone_country": "US",
    "mobile_phone": "21123456",
    "mobile_phone_country": "US"
  ],
  "account_activation_email": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8000/api/sperm-donors")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```