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/surrogate/user-settings/llms.txt. For full documentation content, see https://docs.ivfprovider.com/ivf-agency-ap-is/surrogate/user-settings/llms-full.txt.

# Update Profile Picture

POST http://localhost:8000/api/surrogates/{id}/update-profile-picture
Content-Type: multipart/form-data

Reference: https://docs.ivfprovider.com/ivf-agency-ap-is/surrogate/user-settings/update-profile-picture

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/surrogates/{id}/update-profile-picture:
    post:
      operationId: update-profile-picture
      summary: Update Profile Picture
      tags:
        - subpackage_surrogate.subpackage_surrogate/userSettings
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Surrogate_User Settings_Update Profile
                  Picture_Response_200
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiSurrogatesIdUpdate-profile-pictureRequestUnprocessableEntityError
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                profile_picture:
                  type: string
                  format: binary
              required:
                - profile_picture
servers:
  - url: http://localhost:8000
components:
  schemas:
    Surrogate_User Settings_Update Profile Picture_Response_200:
      type: object
      properties:
        status:
          type: integer
        message:
          type: string
      required:
        - status
        - message
      title: Surrogate_User Settings_Update Profile Picture_Response_200
    ApiSurrogatesIdUpdateProfilePicturePostResponsesContentApplicationJsonSchemaErrors:
      type: object
      properties:
        profile_picture:
          type: array
          items:
            type: string
      required:
        - profile_picture
      title: >-
        ApiSurrogatesIdUpdateProfilePicturePostResponsesContentApplicationJsonSchemaErrors
    PostApiSurrogatesIdUpdate-profile-pictureRequestUnprocessableEntityError:
      type: object
      properties:
        status:
          type: integer
        message:
          type: string
        errors:
          $ref: >-
            #/components/schemas/ApiSurrogatesIdUpdateProfilePicturePostResponsesContentApplicationJsonSchemaErrors
      required:
        - status
        - message
        - errors
      title: PostApiSurrogatesIdUpdate-profile-pictureRequestUnprocessableEntityError
  securitySchemes:
    oauth2Auth:
      type: http
      scheme: bearer

```

## SDK Code Examples

```python Surrogate_User Settings_Update Profile Picture_example
import requests

url = "http://localhost:8000/api/surrogates/19/update-profile-picture"

files = { "profile_picture": "open('string', 'rb')" }
headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, files=files, headers=headers)

print(response.json())
```

```javascript Surrogate_User Settings_Update Profile Picture_example
const url = 'http://localhost:8000/api/surrogates/19/update-profile-picture';
const form = new FormData();
form.append('profile_picture', 'string');

const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

options.body = form;

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

```go Surrogate_User Settings_Update Profile Picture_example
package main

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

func main() {

	url := "http://localhost:8000/api/surrogates/19/update-profile-picture"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"profile_picture\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```ruby Surrogate_User Settings_Update Profile Picture_example
require 'uri'
require 'net/http'

url = URI("http://localhost:8000/api/surrogates/19/update-profile-picture")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"profile_picture\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n"

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

```java Surrogate_User Settings_Update Profile Picture_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://localhost:8000/api/surrogates/19/update-profile-picture")
  .header("Authorization", "Bearer <token>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"profile_picture\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php Surrogate_User Settings_Update Profile Picture_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:8000/api/surrogates/19/update-profile-picture', [
  'multipart' => [
    [
        'name' => 'profile_picture',
        'filename' => 'string',
        'contents' => null
    ]
  ]
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Surrogate_User Settings_Update Profile Picture_example
using RestSharp;

var client = new RestClient("http://localhost:8000/api/surrogates/19/update-profile-picture");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"profile_picture\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Surrogate_User Settings_Update Profile Picture_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]
let parameters = [
  [
    "name": "profile_picture",
    "fileName": "string"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8000/api/surrogates/19/update-profile-picture")! 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()
```