{"openapi":"3.1.0","info":{"title":"Badges API","version":"1.0.0","description":"Emissão e verificação de credenciais Open Badges 3.0. Autentique com `Authorization: Bearer <chave>`."},"servers":[{"url":"https://badges.professorbossini.dev"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/v1/me":{"get":{"summary":"Conta, plano e uso do mês","tags":["Conta"],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/plans":{"get":{"summary":"Planos disponíveis","tags":["Conta"],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/api-keys":{"get":{"summary":"Listar chaves de API","tags":["Conta"],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}},"post":{"summary":"Criar chave de API","tags":["Conta"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100}},"required":["name"]}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/api-keys/{id}":{"delete":{"summary":"Revogar chave de API","tags":["Conta"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/uploads":{"post":{"summary":"Enviar imagem (multipart, campo \"file\", PNG/JPEG até 2 MB)","tags":["Arquivos"],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/issuers":{"get":{"summary":"Listar emissores","tags":["Emissores"],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}},"post":{"summary":"Criar emissor","tags":["Emissores"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"url":{"type":"string","format":"uri"},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"description":{"type":"string","maxLength":2000},"imageUrl":{"type":"string","format":"uri"},"linkedinOrganizationId":{"type":"string","pattern":"^\\d+$"}},"required":["name","url"]}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/issuers/{id}":{"get":{"summary":"Ver emissor","tags":["Emissores"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}},"patch":{"summary":"Atualizar emissor","tags":["Emissores"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"url":{"type":"string","format":"uri"},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"description":{"type":"string","maxLength":2000},"imageUrl":{"type":"string","format":"uri"},"linkedinOrganizationId":{"type":"string","pattern":"^\\d+$"}}}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/issuers/{id}/verify-domain":{"post":{"summary":"Verificar domínio do emissor","tags":["Emissores"],"description":"Confere o registro TXT `_badges-verification.<domínio>` informado em `domainVerification.record`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/achievements":{"get":{"summary":"Listar badges","tags":["Badges"],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}},"post":{"summary":"Criar badge","tags":["Badges"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"issuerId":{"type":"string","minLength":1},"achievementType":{"default":"Badge","type":"string"},"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":5000},"criteriaNarrative":{"type":"string","minLength":1,"maxLength":10000},"imageUrl":{"type":"string","format":"uri"},"tags":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":50}},"validityDays":{"type":"integer","exclusiveMinimum":0,"maximum":36500},"workloadHours":{"type":"integer","exclusiveMinimum":0,"maximum":100000}},"required":["issuerId","name","description","criteriaNarrative"]}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/achievements/{id}":{"get":{"summary":"Ver badge","tags":["Badges"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/credentials":{"post":{"summary":"Emitir credencial","tags":["Credenciais"],"description":"Envie `Idempotency-Key` para poder repetir a chamada com segurança. A resposta traz os links da página, do LinkedIn e do PDF.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"achievementId":{"type":"string","minLength":1},"recipient":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["name","email"]},"evidence":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"name":{"type":"string","maxLength":200},"narrative":{"type":"string","maxLength":5000}}}},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"notify":{"default":true,"type":"boolean"}},"required":["achievementId","recipient"]}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}},"get":{"summary":"Listar credenciais (?achievementId, ?email, ?limit, ?before)","tags":["Credenciais"],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/credentials/batch":{"post":{"summary":"Emitir em lote (até 100)","tags":["Credenciais"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"achievementId":{"type":"string","minLength":1},"recipients":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["name","email"]}},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"notify":{"default":true,"type":"boolean"}},"required":["achievementId","recipients"]}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/credentials/{id}":{"get":{"summary":"Ver credencial","tags":["Credenciais"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/credentials/{id}/revoke":{"post":{"summary":"Revogar credencial","tags":["Credenciais"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/credentials/{id}/resend":{"post":{"summary":"Reenviar e-mail ao destinatário","tags":["Credenciais"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/billing/subscribe":{"post":{"summary":"Assinar plano (Asaas)","tags":["Cobrança"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"plan":{"type":"string","enum":["pro","business"]},"cpfCnpj":{"type":"string","pattern":"^\\d{11}$|^\\d{14}$"},"billingType":{"default":"UNDEFINED","type":"string","enum":["UNDEFINED","PIX","BOLETO","CREDIT_CARD"]}},"required":["plan","cpfCnpj"]}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/v1/billing/cancel":{"post":{"summary":"Cancelar assinatura","tags":["Cobrança"],"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}},"/verify":{"post":{"summary":"Verificar qualquer credencial Open Badges 3.0","tags":["Verificação"],"security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"credential":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["credential"]}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Erro: `{ \"error\": { \"code\", \"message\" } }`"}}}}}}