$url = 'https://api.tiny.com.br/api2/contato.incluir.php';
$token = 'SEU_TOKEN';
$contato = json_encode([
'contatos' => [
[
'contato' => [
'sequencia' => '1',
'codigo' => '1234',
'nome' => 'Contato Teste 1',
'fantasia' => 'Teste 1',
'tipo_pessoa' => 'F',
'cpf_cnpj' => '12345678900',
'endereco' => 'Rua Teste',
'numero' => '123',
'bairro' => 'Centro',
'cep' => '95700-000',
'cidade' => 'Bento Gonçalves',
'uf' => 'RS',
'email' => 'teste@teste.com.br',
'fone' => '(54) 3055-3808',
'situacao' => 'A',
'tipos_contato' => [
['tipo' => 'Cliente'],
['tipo' => 'Fornecedor']
]
]
]
]
]);
$data = "token=$token&contato=$contato&formato=json";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$resultado = json_decode($response, true);