Swap

Consistent identity - Generate swap

Deprecation notice

This endpoint is deprecated. We recommend using alternative endpoints to ensure continued support and compatibility.

Reserved for premium users

Example:


import requests
import json

url_api = 'https://api.piktid.com/api'
face_name = 'face_image_code' # provided by the endpoints /swap/all or /swap/face
target_name = 'target_image_code' # provided by the endpoints /swap/all or /swap/target

options = {}

response_g = requests.post(url_api+'/swap/generate',
headers={'Authorization': 'Bearer '+TOKEN},
data={'face_name':face_name, 'target_name':target_name, 'options':json.dumps(options)},
)

response_json = json.loads(response_g.text)

This function is asynchronous. To retrieve the result, continuously poll (for example every 3 seconds) the /swap/notification_by_name endpoint.

response_n = requests.post(url_api+'/swap/notification_by_name',
headers={'Authorization': 'Bearer '+TOKEN},
json={'name_list':'swap'},
)

response_notifications_json = json.loads(response_n.text)
swap_image_link = response_notifications_json.get('notifications_list',[])[0].get('data',{}).get('links',[])[0].get('l')
POST
/api/swap/generate
AuthorizationBearer <token>

In: header

face_name?string
target_name?string
options?string

Response Body

Examples

curl -X POST "https://api.piktid.com/api/swap/generate" \
  -H "Content-Type: application/json" \
  -d '{}'
{
  "msg": "string"
}
{
  "code": 0,
  "message": "string",
  "description": "string"
}
{
  "code": 0,
  "message": "string",
  "description": "string"
}
{
  "code": 0,
  "message": "string",
  "description": "string"
}