Here is some ruby code you can use that uses the discourse_api gem so that you can use it as a reference. The sync_sso endpoint is a bit different than other endpoints because you need to send it a signed payload.
client = DiscourseApi::Client.new('host')
client.api_key = 'api_key'
client.api_username = 'api_username'
puts client.sync_sso(
sso_secret: 'abcdefghij',
username: '24db27218ed09205a5a0',
name: '24db27218ed09205a5a0',
email: '24db27218ed09205a5a076983bf241ab@example.com',
external_id: '684',
avatar_url: 'https://d3bpeqsaub0i6y.cloudfront.net/user_avatar/meta.discourse.org/codinghorror/240/110067_2.png',
)